diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-10 11:11:28 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-10 11:11:28 +0200 |
commit | 6553912a6dff9b2c8bd3f06cb5f10488eef2c18c (patch) | |
tree | 804cbb720c993afd5453ea4a8086b264e22382fe /lib | |
parent | 74d45762846ea7e6ac09f65fb31672b822f7a349 (diff) | |
download | edoors-ruby-6553912a6dff9b2c8bd3f06cb5f10488eef2c18c.zip edoors-ruby-6553912a6dff9b2c8bd3f06cb5f10488eef2c18c.tar.gz |
project iotas->edoors-ruby, module Iotas->Edoors
Diffstat (limited to 'lib')
-rw-r--r-- | lib/edoors.rb (renamed from lib/iotas.rb) | 24 | ||||
-rw-r--r-- | lib/edoors/board.rb (renamed from lib/iotas/board.rb) | 18 | ||||
-rw-r--r-- | lib/edoors/door.rb (renamed from lib/iotas/door.rb) | 14 | ||||
-rw-r--r-- | lib/edoors/iota.rb (renamed from lib/iotas/iota.rb) | 16 | ||||
-rw-r--r-- | lib/edoors/link.rb (renamed from lib/iotas/link.rb) | 18 | ||||
-rw-r--r-- | lib/edoors/particle.rb (renamed from lib/iotas/particle.rb) | 32 | ||||
-rw-r--r-- | lib/edoors/room.rb (renamed from lib/iotas/room.rb) | 38 | ||||
-rw-r--r-- | lib/edoors/spin.rb (renamed from lib/iotas/spin.rb) | 20 | ||||
-rw-r--r-- | lib/version.rb | 10 |
9 files changed, 95 insertions, 95 deletions
diff --git a/lib/iotas.rb b/lib/edoors.rb index fe837b4..949d4a4 100644 --- a/lib/iotas.rb +++ b/lib/edoors.rb @@ -3,24 +3,24 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. require 'version' # -module Iotas +module Edoors # PATH_SEP = '/'.freeze LINK_SEP = ','.freeze @@ -40,12 +40,12 @@ module Iotas end # require 'json' -require 'iotas/particle' -require 'iotas/iota' -require 'iotas/room' -require 'iotas/spin' -require 'iotas/door' -require 'iotas/board' -require 'iotas/link' +require 'edoors/particle' +require 'edoors/iota' +require 'edoors/room' +require 'edoors/spin' +require 'edoors/door' +require 'edoors/board' +require 'edoors/link' # # EOF diff --git a/lib/iotas/board.rb b/lib/edoors/board.rb index 9371354..a837512 100644 --- a/lib/iotas/board.rb +++ b/lib/edoors/board.rb @@ -3,23 +3,23 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. # -module Iotas +module Edoors # ACT_FOLLOW = 'follow'.freeze # @@ -39,10 +39,10 @@ module Iotas end # def self.json_create o - raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name + raise Edoors::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 Iotas::Particle.json_create(particle.merge!('spin'=>board.spin)) + board.process_p Edoors::Particle.json_create(particle.merge!('spin'=>board.spin)) end board.resume! o board @@ -50,11 +50,11 @@ module Iotas # def process_p p @viewer.receive_p p if @viewer - if p.action!=Iotas::ACT_ERROR + if p.action!=Edoors::ACT_ERROR p2 = @postponed[p.link_value] ||= p return if p2==p @postponed.delete p.link_value - p,p2 = p2,p if p.action==Iotas::ACT_FOLLOW + p,p2 = p2,p if p.action==Edoors::ACT_FOLLOW p.merge! p2 end @saved = p diff --git a/lib/iotas/door.rb b/lib/edoors/door.rb index da4f498..ecbf4a9 100644 --- a/lib/iotas/door.rb +++ b/lib/edoors/door.rb @@ -3,23 +3,23 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. # -module Iotas +module Edoors # class Door < Iota # @@ -36,7 +36,7 @@ module Iotas end # def self.json_create o - raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name + raise Edoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name door = self.new o['name'], o['parent'] door.resume! o door @@ -53,7 +53,7 @@ module Iotas # def garbage puts " ! #{path} didn't give back #{@saved}" if @spin.debug_errors - puts "\t#{@saved.data Iotas::FIELD_ERROR_MSG}" if @saved.action==Iotas::ACT_ERROR + puts "\t#{@saved.data Edoors::FIELD_ERROR_MSG}" if @saved.action==Edoors::ACT_ERROR release_p @saved @saved = nil end diff --git a/lib/iotas/iota.rb b/lib/edoors/iota.rb index 133a6dd..47a2eb6 100644 --- a/lib/iotas/iota.rb +++ b/lib/edoors/iota.rb @@ -3,36 +3,36 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. # -module Iotas +module Edoors # class Iota # def initialize n, p - raise Iotas::Exception.new "Iota name #{n} is not valid" if n.include? Iotas::PATH_SEP + raise Edoors::Exception.new "Iota name #{n} is not valid" if n.include? Edoors::PATH_SEP @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+Iotas::PATH_SEP : '') + @name + @path = ( @parent ? @parent.path+Edoors::PATH_SEP : '') + @name @spin = ( @parent ? @parent.spin : self ) if @parent @parent.add_iota self - @spin.add_to_world self if @spin.is_a? Iotas::Spin + @spin.add_to_world self if @spin.is_a? Edoors::Spin end end # diff --git a/lib/iotas/link.rb b/lib/edoors/link.rb index 073ca1f..b6a3fb9 100644 --- a/lib/iotas/link.rb +++ b/lib/edoors/link.rb @@ -3,23 +3,23 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. # -module Iotas +module Edoors # LNK_SRC = 'edoors_lnk_src'.freeze LNK_DSTS = 'edoors_lnk_dsts'.freeze @@ -50,14 +50,14 @@ module Iotas end # def self.json_create o - raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name + raise Edoors::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 - 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)) + Edoors::Link.new(p.get_data(Edoors::LNK_SRC), p.get_data(Edoors::LNK_DSTS), + p.get_data(Edoors::LNK_FIELDS), p.get_data(Edoors::LNK_CONDF), + p.get_data(Edoors::LNK_CONDV)) end # attr_accessor :door diff --git a/lib/iotas/particle.rb b/lib/edoors/particle.rb index 79cebfb..c17f551 100644 --- a/lib/iotas/particle.rb +++ b/lib/edoors/particle.rb @@ -3,24 +3,24 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. require 'time' # -module Iotas +module Edoors # class Particle # @@ -71,7 +71,7 @@ module Iotas end # def self.json_create o - raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name + raise Edoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name self.new o end # @@ -104,22 +104,22 @@ module Iotas end # def add_dsts dsts - 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" + dsts.split(Edoors::LINK_SEP).each do |dst| + if dst.empty? or dst[0]==Edoors::PATH_SEP or dst[0]==Edoors::PATH_SEP or dst=~/\/\?/\ + or dst=~/\/{2,}/ or dst=~/\s+/ or dst==Edoors::ACT_SEP + raise Edoors::Exception.new "destination #{dst} is not acceptable" end @dsts << dst end end # def add_dst a, d='' - add_dsts d+Iotas::ACT_SEP+a + add_dsts d+Edoors::ACT_SEP+a end # def set_dst! a, d @action = a - if d.is_a? Iotas::Iota + if d.is_a? Edoors::Iota @dst = d else _split_path! d @@ -129,12 +129,12 @@ module Iotas def split_dst! @dst = @room = @door = @action = nil return if (n = next_dst).nil? - p, @action = n.split Iotas::ACT_SEP + p, @action = n.split Edoors::ACT_SEP _split_path! p end # def _split_path! p - i = p.rindex Iotas::PATH_SEP + i = p.rindex Edoors::PATH_SEP if i.nil? @room = nil @door = p @@ -152,9 +152,9 @@ module Iotas end # def error! e, dst=nil - @action = Iotas::ACT_ERROR + @action = Edoors::ACT_ERROR @dst = dst||@src - @payload[Iotas::FIELD_ERROR_MSG]=e + @payload[Edoors::FIELD_ERROR_MSG]=e end # def apply_link! lnk diff --git a/lib/iotas/room.rb b/lib/edoors/room.rb index 7ffc5f4..1c855c1 100644 --- a/lib/iotas/room.rb +++ b/lib/edoors/room.rb @@ -3,23 +3,23 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. # -module Iotas +module Edoors # ERROR_ROUTE_NS = 'routing error: no source'.freeze ERROR_ROUTE_RRWD = 'routing error: right room, wrong door'.freeze @@ -45,29 +45,29 @@ module Iotas end # def self.json_create o - raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name + raise Edoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name room = self.new o['name'], o['parent'] o['iotas'].each do |name,iota| eval( iota['kls'] ).json_create(iota.merge!('parent'=>room)) end o['links'].each do |src,links| links.each do |link| - room.add_link Iotas::Link.json_create(link) + room.add_link Edoors::Link.json_create(link) end end room end # def add_iota s - raise Iotas::Exception.new "Iota #{s.name} already has #{s.parent.name} as parent" if not s.parent.nil? and s.parent!=self - raise Iotas::Exception.new "Iota #{s.name} already exists in #{path}" if @iotas.has_key? s.name + raise Edoors::Exception.new "Iota #{s.name} already has #{s.parent.name} as parent" if not s.parent.nil? and s.parent!=self + raise Edoors::Exception.new "Iota #{s.name} already exists in #{path}" if @iotas.has_key? s.name s.parent = self if s.parent.nil? @iotas[s.name]=s end # def add_link l l.door = @iotas[l.src] - raise Iotas::Exception.new "Link source #{l.src} does not exist in #{path}" if l.door.nil? + raise Edoors::Exception.new "Link source #{l.src} does not exist in #{path}" if l.door.nil? (@links[l.src] ||= [])<< l end # @@ -124,12 +124,12 @@ module Iotas if door = @iotas[p.door] p.dst_routed! door else - p.error! Iotas::ERROR_ROUTE_RRWD + p.error! Edoors::ERROR_ROUTE_RRWD end - elsif door = @spin.search_world(p.room+Iotas::PATH_SEP+p.door) + elsif door = @spin.search_world(p.room+Edoors::PATH_SEP+p.door) p.dst_routed! door else - p.error! Iotas::ERROR_ROUTE_DNE + p.error! Edoors::ERROR_ROUTE_DNE end end private :_route @@ -137,7 +137,7 @@ module Iotas def _send sys, p if not sys and p.src.nil? # do not route non system orphan particles !! - p.error! Iotas::ERROR_ROUTE_NS, @spin + p.error! Edoors::ERROR_ROUTE_NS, @spin elsif p.dst # direct routing through pointer return @@ -157,7 +157,7 @@ module Iotas elsif not sys and _try_links p return else - p.error!( sys ? Iotas::ERROR_ROUTE_SND : Iotas::ERROR_ROUTE_NDNL) + p.error!( sys ? Edoors::ERROR_ROUTE_SND : Edoors::ERROR_ROUTE_NDNL) end end private :_send @@ -165,20 +165,20 @@ module Iotas def send_p p puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if @spin.debug_routing _send false, p - puts " -> #{p.dst.path}#{Iotas::ACT_SEP}#{p.action}" if @spin.debug_routing + puts " -> #{p.dst.path}#{Edoors::ACT_SEP}#{p.action}" if @spin.debug_routing @spin.post_p p end # def send_sys_p p puts " * send_sys_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if @spin.debug_routing _send true, p - puts " -> #{p.dst.path}#{Iotas::ACT_SEP}#{p.action}" if @spin.debug_routing + puts " -> #{p.dst.path}#{Edoors::ACT_SEP}#{p.action}" if @spin.debug_routing @spin.post_sys_p p end # def process_sys_p p - if p.action==Iotas::SYS_ACT_ADD_LINK - add_link Iotas::Link.from_particle_data p + if p.action==Edoors::SYS_ACT_ADD_LINK + add_link Edoors::Link.from_particle_data p end @spin.release_p p end diff --git a/lib/iotas/spin.rb b/lib/edoors/spin.rb index 1f3c180..2bb76f8 100644 --- a/lib/iotas/spin.rb +++ b/lib/edoors/spin.rb @@ -3,23 +3,23 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. # -module Iotas +module Edoors # class Spin < Room # @@ -39,13 +39,13 @@ module Iotas # if not o.empty? o['iotas'].each do |name,iota| - Iotas::Room.json_create(iota.merge!('parent'=>self)) + Edoors::Room.json_create(iota.merge!('parent'=>self)) end if o['iotas'] o['app_fifo'].each do |particle| - @app_fifo << Iotas::Particle.json_create(particle.merge!('spin'=>self)) + @app_fifo << Edoors::Particle.json_create(particle.merge!('spin'=>self)) end if o['app_fifo'] o['sys_fifo'].each do |particle| - @sys_fifo << Iotas::Particle.json_create(particle.merge!('spin'=>self)) + @sys_fifo << Edoors::Particle.json_create(particle.merge!('spin'=>self)) end if o['sys_fifo'] end end @@ -67,7 +67,7 @@ module Iotas end # def self.json_create o - raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name + raise Edoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name self.new o['name'], o end # @@ -113,7 +113,7 @@ module Iotas end # def process_sys_p p - if p.action==Iotas::SYS_ACT_HIBERNATE + if p.action==Edoors::SYS_ACT_HIBERNATE stop! hibernate! p[FIELD_HIBERNATE_PATH] else diff --git a/lib/version.rb b/lib/version.rb index b4567e2..3430fcb 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -3,23 +3,23 @@ # # Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch> # -# This file is part of iotas. +# This file is part of edoors-ruby. # -# iotas is free software: you can redistribute it and/or modify +# edoors-ruby 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. # -# iotas is distributed in the hope that it will be useful, +# edoors-ruby 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 iotas. If not, see <http://www.gnu.org/licenses/>. +# along with edoors-ruby. If not, see <http://www.gnu.org/licenses/>. # -module Iotas +module Edoors # VERSION = "0.0.4" # |