summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/iotas.rb (renamed from lib/evendoors.rb)24
-rw-r--r--lib/iotas/board.rb (renamed from lib/evendoors/board.rb)18
-rw-r--r--lib/iotas/door.rb (renamed from lib/evendoors/door.rb)14
-rw-r--r--lib/iotas/link.rb (renamed from lib/evendoors/link.rb)18
-rw-r--r--lib/iotas/particle.rb (renamed from lib/evendoors/particle.rb)30
-rw-r--r--lib/iotas/room.rb (renamed from lib/evendoors/room.rb)42
-rw-r--r--lib/iotas/spin.rb (renamed from lib/evendoors/spin.rb)22
-rw-r--r--lib/iotas/spot.rb (renamed from lib/evendoors/spot.rb)18
8 files changed, 93 insertions, 93 deletions
diff --git a/lib/evendoors.rb b/lib/iotas.rb
index e57cf26..24c021e 100644
--- a/lib/evendoors.rb
+++ b/lib/iotas.rb
@@ -3,23 +3,23 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
#
-module EvenDoors
+module Iotas
#
PATH_SEP = '/'.freeze
LINK_SEP = ','.freeze
@@ -53,12 +53,12 @@ module EvenDoors
end
#
require 'json'
-require 'evendoors/particle'
-require 'evendoors/spot'
-require 'evendoors/room'
-require 'evendoors/spin'
-require 'evendoors/door'
-require 'evendoors/board'
-require 'evendoors/link'
+require 'iotas/particle'
+require 'iotas/spot'
+require 'iotas/room'
+require 'iotas/spin'
+require 'iotas/door'
+require 'iotas/board'
+require 'iotas/link'
#
# EOF
diff --git a/lib/evendoors/board.rb b/lib/iotas/board.rb
index a81b31a..8c1991f 100644
--- a/lib/evendoors/board.rb
+++ b/lib/iotas/board.rb
@@ -3,23 +3,23 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
#
-module EvenDoors
+module Iotas
#
class Board < Door
#
@@ -37,10 +37,10 @@ module EvenDoors
end
#
def self.json_create o
- raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
+ raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
board = self.new o['name'], o['parent']
o['postponed'].each do |link_value,particle|
- board.process_p EvenDoors::Particle.json_create(particle.merge!('spin'=>board.spin))
+ board.process_p Iotas::Particle.json_create(particle.merge!('spin'=>board.spin))
end
board.resume! o
board
@@ -48,11 +48,11 @@ module EvenDoors
#
def process_p p
@viewer.receive_p p if @viewer
- if p.action!=EvenDoors::ACT_ERROR
+ if p.action!=Iotas::ACT_ERROR
p2 = @postponed[p.link_value] ||= p
return if p2==p
@postponed.delete p.link_value
- p,p2 = p2,p if p.action==EvenDoors::ACT_FOLLOW
+ p,p2 = p2,p if p.action==Iotas::ACT_FOLLOW
p.merge! p2
end
@saved = p
diff --git a/lib/evendoors/door.rb b/lib/iotas/door.rb
index bcf8534..8474b09 100644
--- a/lib/evendoors/door.rb
+++ b/lib/iotas/door.rb
@@ -3,23 +3,23 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
#
-module EvenDoors
+module Iotas
#
class Door < Spot
#
@@ -36,7 +36,7 @@ module EvenDoors
end
#
def self.json_create o
- raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
+ raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
door = self.new o['name'], o['parent']
door.resume! o
door
@@ -55,7 +55,7 @@ module EvenDoors
#
def garbage
puts " ! #{path} didn't give back #{@saved}" if @spin.debug_errors
- puts "\t#{@saved.data EvenDoors::FIELD_ERROR_MSG}" if @saved.action==EvenDoors::ACT_ERROR
+ puts "\t#{@saved.data Iotas::FIELD_ERROR_MSG}" if @saved.action==Iotas::ACT_ERROR
release_p @saved
@saved = nil
end
diff --git a/lib/evendoors/link.rb b/lib/iotas/link.rb
index 1e11191..b1fd9ba 100644
--- a/lib/evendoors/link.rb
+++ b/lib/iotas/link.rb
@@ -3,23 +3,23 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
#
-module EvenDoors
+module Iotas
#
class Link
#
@@ -44,14 +44,14 @@ module EvenDoors
end
#
def self.json_create o
- raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
+ raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
self.new o['src'], o['dsts'], o['fields'], o['cond_fields'], o['cond_value']
end
#
def self.from_particle_data p
- EvenDoors::Link.new(p.get_data(EvenDoors::LNK_SRC), p.get_data(EvenDoors::LNK_DSTS),
- p.get_data(EvenDoors::LNK_FIELDS), p.get_data(EvenDoors::LNK_CONDF),
- p.get_data(EvenDoors::LNK_CONDV))
+ Iotas::Link.new(p.get_data(Iotas::LNK_SRC), p.get_data(Iotas::LNK_DSTS),
+ p.get_data(Iotas::LNK_FIELDS), p.get_data(Iotas::LNK_CONDF),
+ p.get_data(Iotas::LNK_CONDV))
end
#
attr_accessor :door
diff --git a/lib/evendoors/particle.rb b/lib/iotas/particle.rb
index b3bfa82..ffb141b 100644
--- a/lib/evendoors/particle.rb
+++ b/lib/iotas/particle.rb
@@ -3,24 +3,24 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
require 'time'
#
-module EvenDoors
+module Iotas
#
class Particle
#
@@ -71,7 +71,7 @@ module EvenDoors
end
#
def self.json_create o
- raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
+ raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
self.new o
end
#
@@ -98,10 +98,10 @@ module EvenDoors
end
#
def add_dsts dsts
- dsts.split(EvenDoors::LINK_SEP).each do |dst|
- if dst.empty? or dst[0]==EvenDoors::PATH_SEP or dst[0]==EvenDoors::PATH_SEP or dst=~/\/\?/\
- or dst=~/\/{2,}/ or dst=~/\s+/ or dst==EvenDoors::ACT_SEP
- raise EvenDoors::Exception.new "destination #{dst} is not acceptable"
+ dsts.split(Iotas::LINK_SEP).each do |dst|
+ if dst.empty? or dst[0]==Iotas::PATH_SEP or dst[0]==Iotas::PATH_SEP or dst=~/\/\?/\
+ or dst=~/\/{2,}/ or dst=~/\s+/ or dst==Iotas::ACT_SEP
+ raise Iotas::Exception.new "destination #{dst} is not acceptable"
end
@dsts << dst
end
@@ -110,14 +110,14 @@ module EvenDoors
def set_dst! a, d=''
@dst = @room = @door = @action = nil
clear_dsts!
- add_dsts d+EvenDoors::ACT_SEP+a
+ add_dsts d+Iotas::ACT_SEP+a
end
#
def split_dst!
@dst = @room = @door = @action = nil
return if (n = next_dst).nil?
- p, @action = n.split EvenDoors::ACT_SEP
- i = p.rindex EvenDoors::PATH_SEP
+ p, @action = n.split Iotas::ACT_SEP
+ i = p.rindex Iotas::PATH_SEP
if i.nil?
@room = nil
@door = p
@@ -134,9 +134,9 @@ module EvenDoors
end
#
def error! e, dst=nil
- @action = EvenDoors::ACT_ERROR
+ @action = Iotas::ACT_ERROR
@dst = dst||@src
- @payload[EvenDoors::FIELD_ERROR_MSG]=e
+ @payload[Iotas::FIELD_ERROR_MSG]=e
end
#
def apply_link! lnk
diff --git a/lib/evendoors/room.rb b/lib/iotas/room.rb
index caaf565..569c921 100644
--- a/lib/evendoors/room.rb
+++ b/lib/iotas/room.rb
@@ -3,23 +3,23 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
#
-module EvenDoors
+module Iotas
#
class Room < Spot
#
@@ -39,29 +39,29 @@ module EvenDoors
end
#
def self.json_create o
- raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
+ raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
room = self.new o['name'], o['parent']
o['spots'].each do |name,spot|
eval( spot['kls'] ).json_create(spot.merge!('parent'=>room))
end
o['links'].each do |src,links|
links.each do |link|
- room.add_link EvenDoors::Link.json_create(link)
+ room.add_link Iotas::Link.json_create(link)
end
end
room
end
#
def add_spot s
- raise EvenDoors::Exception.new "Spot #{s.name} already has #{s.parent.name} as parent" if not s.parent.nil? and s.parent!=self
- raise EvenDoors::Exception.new "Spot #{s.name} already exists in #{path}" if @spots.has_key? s.name
+ raise Iotas::Exception.new "Spot #{s.name} already has #{s.parent.name} as parent" if not s.parent.nil? and s.parent!=self
+ raise Iotas::Exception.new "Spot #{s.name} already exists in #{path}" if @spots.has_key? s.name
s.parent = self if s.parent.nil?
@spots[s.name]=s
end
#
def add_link l
l.door = @spots[l.src]
- raise EvenDoors::Exception.new "Link source #{l.src} does not exist in #{path}" if l.door.nil?
+ raise Iotas::Exception.new "Link source #{l.src} does not exist in #{path}" if l.door.nil?
(@links[l.src] ||= [])<< l
end
#
@@ -117,19 +117,19 @@ module EvenDoors
if door = @spots[p.door]
p.dst_routed! door
else
- p.error! EvenDoors::ERROR_ROUTE_RRWD
+ p.error! Iotas::ERROR_ROUTE_RRWD
end
elsif (p.room=~/^#{path}\/(.*)/)==0
- room, *more = $1.split EvenDoors::PATH_SEP
+ room, *more = $1.split Iotas::PATH_SEP
if child=@spots[room]
child.route_p p
else
- p.error! EvenDoors::ERROR_ROUTE_DDWR
+ p.error! Iotas::ERROR_ROUTE_DDWR
end
elsif @parent
@parent.route_p p
else
- p.error! EvenDoors::ERROR_ROUTE_TRWR
+ p.error! Iotas::ERROR_ROUTE_TRWR
end
end
#
@@ -137,7 +137,7 @@ module EvenDoors
puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if @spin.debug_routing
if p.src.nil?
# do not route orphan particles !!
- p.error! EvenDoors::ERROR_ROUTE_NS, @spin
+ p.error! Iotas::ERROR_ROUTE_NS, @spin
elsif p.next_dst
p.split_dst!
if p.door
@@ -149,9 +149,9 @@ module EvenDoors
elsif try_links p
return
else
- p.error! EvenDoors::ERROR_ROUTE_NDNL
+ p.error! Iotas::ERROR_ROUTE_NDNL
end
- puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if @spin.debug_routing
+ puts " -> #{p.dst.path}#{Iotas::ACT_SEP}#{p.action}" if @spin.debug_routing
@spin.post_p p
end
#
@@ -165,15 +165,15 @@ module EvenDoors
p.dst_routed! @spin
end
else
- p.error! EvenDoors::ERROR_ROUTE_SND
+ p.error! Iotas::ERROR_ROUTE_SND
end
- puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if @spin.debug_routing
+ puts " -> #{p.dst.path}#{Iotas::ACT_SEP}#{p.action}" if @spin.debug_routing
@spin.post_sys_p p
end
#
def process_sys_p p
- if p.action==EvenDoors::SYS_ACT_ADD_LINK
- add_link EvenDoors::Link.from_particle_data p
+ if p.action==Iotas::SYS_ACT_ADD_LINK
+ add_link Iotas::Link.from_particle_data p
end
@spin.release_p p
end
diff --git a/lib/evendoors/spin.rb b/lib/iotas/spin.rb
index 5361a76..03c0141 100644
--- a/lib/evendoors/spin.rb
+++ b/lib/iotas/spin.rb
@@ -3,23 +3,23 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
#
-module EvenDoors
+module Iotas
#
class Spin < Room
#
@@ -32,19 +32,19 @@ module EvenDoors
#
@run = false
@hibernation = o['hibernation']||false
- @hibernate_path = 'evendoors-hibernate-'+n+'.json'
+ @hibernate_path = 'iotas-hibernate-'+n+'.json'
@debug_errors = o[:debug_errors]||o['debug_errors']||false
@debug_routing = o[:debug_routing]||o['debug_routing']||false
#
if not o.empty?
o['spots'].each do |name,spot|
- EvenDoors::Room.json_create(spot.merge!('parent'=>self))
+ Iotas::Room.json_create(spot.merge!('parent'=>self))
end if o['spots']
o['app_fifo'].each do |particle|
- @app_fifo << EvenDoors::Particle.json_create(particle.merge!('spin'=>self))
+ @app_fifo << Iotas::Particle.json_create(particle.merge!('spin'=>self))
end if o['app_fifo']
o['sys_fifo'].each do |particle|
- @sys_fifo << EvenDoors::Particle.json_create(particle.merge!('spin'=>self))
+ @sys_fifo << Iotas::Particle.json_create(particle.merge!('spin'=>self))
end if o['sys_fifo']
end
end
@@ -66,7 +66,7 @@ module EvenDoors
end
#
def self.json_create o
- raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
+ raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
self.new o['name'], o
end
#
@@ -104,7 +104,7 @@ module EvenDoors
end
#
def process_sys_p p
- if p.action==EvenDoors::SYS_ACT_HIBERNATE
+ if p.action==Iotas::SYS_ACT_HIBERNATE
stop!
hibernate! p[FIELD_HIBERNATE_PATH]
else
diff --git a/lib/evendoors/spot.rb b/lib/iotas/spot.rb
index cbaba7a..aca0c2b 100644
--- a/lib/evendoors/spot.rb
+++ b/lib/iotas/spot.rb
@@ -3,23 +3,23 @@
#
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
#
-# This file is part of evendoors-ruby.
+# This file is part of iotas.
#
-# evendoors-ruby is free software: you can redistribute it and/or modify
+# iotas is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# evendoors-ruby is distributed in the hope that it will be useful,
+# iotas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with evendoors-ruby. If not, see <http://www.gnu.org/licenses/>.
+# along with iotas. If not, see <http://www.gnu.org/licenses/>.
#
-module EvenDoors
+module Iotas
#
class Spot
#
@@ -27,21 +27,21 @@ module EvenDoors
@name = n # unique in it's room
@parent = p # single direct parent
@viewer = nil # particle going through that position will be sent there readonly
- @path = ( @parent ? @parent.path+EvenDoors::PATH_SEP : '') + @name
+ @path = ( @parent ? @parent.path+Iotas::PATH_SEP : '') + @name
@spin = ( @parent ? @parent.spin : self )
@parent.add_spot self if @parent
- raise EvenDoors::Exception.new "Spot name #{name} is not valid" if @name.include? EvenDoors::PATH_SEP
+ raise Iotas::Exception.new "Spot name #{name} is not valid" if @name.include? Iotas::PATH_SEP
end
#
attr_reader :name, :path, :spin
attr_accessor :viewer, :parent
#
def start!
- # override this to initialize yout object on stystem start
+ # override this to initialize your object on system start
end
#
def stop!
- # override this to initialize yout object on stystem stop
+ # override this to initialize your object on system stop
end
#
def hibernate!