iotas 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +4 -9
- data/Gemfile.lock +1 -1
- data/README.md +4 -14
- data/iotas.gemspec +1 -1
- data/lib/version.rb +1 -1
- metadata +4 -30
- data/lib/iotas.rb +0 -51
- data/lib/iotas/board.rb +0 -69
- data/lib/iotas/door.rb +0 -93
- data/lib/iotas/iota.rb +0 -67
- data/lib/iotas/link.rb +0 -70
- data/lib/iotas/particle.rb +0 -226
- data/lib/iotas/room.rb +0 -192
- data/lib/iotas/spin.rb +0 -159
- data/spec/board_spec.rb +0 -95
- data/spec/door_spec.rb +0 -98
- data/spec/link_spec.rb +0 -38
- data/spec/particle_spec.rb +0 -257
- data/spec/room_spec.rb +0 -303
- data/spec/spec_helper.rb +0 -38
- data/spec/spin_spec.rb +0 -129
- data/spec/spot_spec.rb +0 -26
- data/test/test_iotas.rb +0 -168
data/Changelog
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
2012-
|
2
|
-
*
|
3
|
-
*
|
4
|
-
|
5
|
-
2012-05-18 Jérémy Zurcher <jeremy@asynk.ch>
|
6
|
-
* first release : v0.0.2
|
7
|
-
|
8
|
-
2012-05-01 Jérémy Zurcher <jeremy@asynk.ch>
|
9
|
-
* Project creation
|
1
|
+
2012-06-13 Jérémy Zurcher <jeremy@asynk.ch>
|
2
|
+
* this project has been renamed edoors-ruby
|
3
|
+
* https://github.com/jeremyz/edoors-ruby
|
4
|
+
* https://github.com/jeremyz/edoors C/efl WIP
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,17 +2,7 @@
|
|
2
2
|
by Jérémy Zurcher
|
3
3
|
http://asynk.ch
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
|
9
|
-
## FEATURES/PROBLEMS:
|
10
|
-
[![Build Status](https://secure.travis-ci.org/jeremyz/iotas.png)](http://travis-ci.org/jeremyz/iotas)
|
11
|
-
|
12
|
-
## SYNOPSIS:
|
13
|
-
|
14
|
-
* experimental material, we'll see where it leads
|
15
|
-
|
16
|
-
## LICENSE:
|
17
|
-
|
18
|
-
[AGPL](http://www.gnu.org/licenses/agpl-3.0.html)
|
5
|
+
2012-06-13
|
6
|
+
* this project has been renamed edoors-ruby
|
7
|
+
* https://github.com/jeremyz/edoors-ruby
|
8
|
+
* https://github.com/jeremyz/edoors C/efl WIP
|
data/iotas.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.version = Iotas::VERSION
|
10
10
|
s.authors = ["Jérémy Zurcher"]
|
11
11
|
s.email = ["jeremy@asynk.ch"]
|
12
|
-
s.homepage = "http://github.com/jeremyz/
|
12
|
+
s.homepage = "http://github.com/jeremyz/edoors-ruby"
|
13
13
|
s.summary = %q{ruby rewrite of C++ application framework evenja (http://www.revena.com/evenja)}
|
14
14
|
s.description = %q{Evenja propose a data centric paradigm. A traditional programm composed of many functions
|
15
15
|
is decomposed into small autonomous modifications applied on the data implemented in different instances of Door base class.
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iotas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -78,25 +78,8 @@ files:
|
|
78
78
|
- README.md
|
79
79
|
- Rakefile
|
80
80
|
- iotas.gemspec
|
81
|
-
- lib/iotas.rb
|
82
|
-
- lib/iotas/board.rb
|
83
|
-
- lib/iotas/door.rb
|
84
|
-
- lib/iotas/iota.rb
|
85
|
-
- lib/iotas/link.rb
|
86
|
-
- lib/iotas/particle.rb
|
87
|
-
- lib/iotas/room.rb
|
88
|
-
- lib/iotas/spin.rb
|
89
81
|
- lib/version.rb
|
90
|
-
|
91
|
-
- spec/door_spec.rb
|
92
|
-
- spec/link_spec.rb
|
93
|
-
- spec/particle_spec.rb
|
94
|
-
- spec/room_spec.rb
|
95
|
-
- spec/spec_helper.rb
|
96
|
-
- spec/spin_spec.rb
|
97
|
-
- spec/spot_spec.rb
|
98
|
-
- test/test_iotas.rb
|
99
|
-
homepage: http://github.com/jeremyz/iotas
|
82
|
+
homepage: http://github.com/jeremyz/edoors-ruby
|
100
83
|
licenses: []
|
101
84
|
post_install_message:
|
102
85
|
rdoc_options: []
|
@@ -120,13 +103,4 @@ rubygems_version: 1.8.23
|
|
120
103
|
signing_key:
|
121
104
|
specification_version: 3
|
122
105
|
summary: ruby rewrite of C++ application framework evenja (http://www.revena.com/evenja)
|
123
|
-
test_files:
|
124
|
-
- spec/board_spec.rb
|
125
|
-
- spec/door_spec.rb
|
126
|
-
- spec/link_spec.rb
|
127
|
-
- spec/particle_spec.rb
|
128
|
-
- spec/room_spec.rb
|
129
|
-
- spec/spec_helper.rb
|
130
|
-
- spec/spin_spec.rb
|
131
|
-
- spec/spot_spec.rb
|
132
|
-
- test/test_iotas.rb
|
106
|
+
test_files: []
|
data/lib/iotas.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
|
5
|
-
#
|
6
|
-
# This file is part of iotas.
|
7
|
-
#
|
8
|
-
# iotas is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Affero General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# iotas is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Affero General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Affero General Public License
|
19
|
-
# along with iotas. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
|
21
|
-
require 'version'
|
22
|
-
#
|
23
|
-
module Iotas
|
24
|
-
#
|
25
|
-
PATH_SEP = '/'.freeze
|
26
|
-
LINK_SEP = ','.freeze
|
27
|
-
ACT_SEP = '?'.freeze
|
28
|
-
#
|
29
|
-
ACT_GET = 'get'.freeze
|
30
|
-
ACT_ERROR = 'error'.freeze
|
31
|
-
#
|
32
|
-
SYS_ACT_HIBERNATE = 'hibernate'.freeze
|
33
|
-
SYS_ACT_ADD_LINK = 'sys_add_link'.freeze
|
34
|
-
#
|
35
|
-
FIELD_ERROR_MSG = 'edoors_error'.freeze
|
36
|
-
FIELD_HIBERNATE_PATH= 'hibernate_path'.freeze
|
37
|
-
#
|
38
|
-
class Exception < ::Exception; end
|
39
|
-
#
|
40
|
-
end
|
41
|
-
#
|
42
|
-
require 'json'
|
43
|
-
require 'iotas/particle'
|
44
|
-
require 'iotas/iota'
|
45
|
-
require 'iotas/room'
|
46
|
-
require 'iotas/spin'
|
47
|
-
require 'iotas/door'
|
48
|
-
require 'iotas/board'
|
49
|
-
require 'iotas/link'
|
50
|
-
#
|
51
|
-
# EOF
|
data/lib/iotas/board.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
|
5
|
-
#
|
6
|
-
# This file is part of iotas.
|
7
|
-
#
|
8
|
-
# iotas is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Affero General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# iotas is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Affero General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Affero General Public License
|
19
|
-
# along with iotas. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
|
21
|
-
#
|
22
|
-
module Iotas
|
23
|
-
#
|
24
|
-
ACT_FOLLOW = 'follow'.freeze
|
25
|
-
#
|
26
|
-
class Board < Door
|
27
|
-
#
|
28
|
-
def initialize n, p
|
29
|
-
super n, p
|
30
|
-
@postponed = {}
|
31
|
-
end
|
32
|
-
#
|
33
|
-
def to_json *a
|
34
|
-
{
|
35
|
-
'kls' => self.class.name,
|
36
|
-
'name' => @name,
|
37
|
-
'postponed' => @postponed
|
38
|
-
}.merge(hibernate!).to_json *a
|
39
|
-
end
|
40
|
-
#
|
41
|
-
def self.json_create o
|
42
|
-
raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
|
43
|
-
board = self.new o['name'], o['parent']
|
44
|
-
o['postponed'].each do |link_value,particle|
|
45
|
-
board.process_p Iotas::Particle.json_create(particle.merge!('spin'=>board.spin))
|
46
|
-
end
|
47
|
-
board.resume! o
|
48
|
-
board
|
49
|
-
end
|
50
|
-
#
|
51
|
-
def process_p p
|
52
|
-
@viewer.receive_p p if @viewer
|
53
|
-
if p.action!=Iotas::ACT_ERROR
|
54
|
-
p2 = @postponed[p.link_value] ||= p
|
55
|
-
return if p2==p
|
56
|
-
@postponed.delete p.link_value
|
57
|
-
p,p2 = p2,p if p.action==Iotas::ACT_FOLLOW
|
58
|
-
p.merge! p2
|
59
|
-
end
|
60
|
-
@saved = p
|
61
|
-
receive_p p
|
62
|
-
garbage if not @saved.nil?
|
63
|
-
end
|
64
|
-
#
|
65
|
-
end
|
66
|
-
#
|
67
|
-
end
|
68
|
-
#
|
69
|
-
# EOF
|
data/lib/iotas/door.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
|
5
|
-
#
|
6
|
-
# This file is part of iotas.
|
7
|
-
#
|
8
|
-
# iotas is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Affero General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# iotas is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Affero General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Affero General Public License
|
19
|
-
# along with iotas. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
|
21
|
-
#
|
22
|
-
module Iotas
|
23
|
-
#
|
24
|
-
class Door < Iota
|
25
|
-
#
|
26
|
-
def initialize n, p
|
27
|
-
super n, p
|
28
|
-
@saved = nil
|
29
|
-
end
|
30
|
-
#
|
31
|
-
def to_json *a
|
32
|
-
{
|
33
|
-
'kls' => self.class.name,
|
34
|
-
'name' => @name
|
35
|
-
}.merge(hibernate!).to_json *a
|
36
|
-
end
|
37
|
-
#
|
38
|
-
def self.json_create o
|
39
|
-
raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
|
40
|
-
door = self.new o['name'], o['parent']
|
41
|
-
door.resume! o
|
42
|
-
door
|
43
|
-
end
|
44
|
-
#
|
45
|
-
def require_p p_kls
|
46
|
-
p = @spin.require_p p_kls
|
47
|
-
p.init! self
|
48
|
-
p
|
49
|
-
end
|
50
|
-
#
|
51
|
-
def release_p p
|
52
|
-
@saved=nil if @saved==p # particle is released, all is good
|
53
|
-
@spin.release_p p
|
54
|
-
end
|
55
|
-
#
|
56
|
-
def garbage
|
57
|
-
puts " ! #{path} didn't give back #{@saved}" if @spin.debug_errors
|
58
|
-
puts "\t#{@saved.data Iotas::FIELD_ERROR_MSG}" if @saved.action==Iotas::ACT_ERROR
|
59
|
-
release_p @saved
|
60
|
-
@saved = nil
|
61
|
-
end
|
62
|
-
#
|
63
|
-
def process_p p
|
64
|
-
@viewer.receive_p p if @viewer
|
65
|
-
@saved = p
|
66
|
-
receive_p p
|
67
|
-
garbage if not @saved.nil?
|
68
|
-
end
|
69
|
-
#
|
70
|
-
def process_sys_p p
|
71
|
-
# nothing todo with it now
|
72
|
-
@spin.release_p p
|
73
|
-
end
|
74
|
-
#
|
75
|
-
def send_p p, a=nil
|
76
|
-
p.init! self
|
77
|
-
p.set_dst! a, self if a
|
78
|
-
@saved=nil if @saved==p # particle is sent back the data, all is good
|
79
|
-
@parent.send_p p # daddy will know what to do
|
80
|
-
end
|
81
|
-
#
|
82
|
-
def send_sys_p p, a=nil
|
83
|
-
p.init! self
|
84
|
-
p.set_dst! a, self if a
|
85
|
-
@saved=nil if @saved==p # particle is sent back the data, all is good
|
86
|
-
@parent.send_sys_p p # daddy will know what to do
|
87
|
-
end
|
88
|
-
#
|
89
|
-
end
|
90
|
-
#
|
91
|
-
end
|
92
|
-
#
|
93
|
-
# EOF
|
data/lib/iotas/iota.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
|
5
|
-
#
|
6
|
-
# This file is part of iotas.
|
7
|
-
#
|
8
|
-
# iotas is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Affero General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# iotas is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Affero General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Affero General Public License
|
19
|
-
# along with iotas. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
|
21
|
-
#
|
22
|
-
module Iotas
|
23
|
-
#
|
24
|
-
class Iota
|
25
|
-
#
|
26
|
-
def initialize n, p
|
27
|
-
raise Iotas::Exception.new "Iota name #{n} is not valid" if n.include? Iotas::PATH_SEP
|
28
|
-
@name = n # unique in it's room
|
29
|
-
@parent = p # single direct parent
|
30
|
-
@viewer = nil # particle going through that position will be sent there readonly
|
31
|
-
@path = ( @parent ? @parent.path+Iotas::PATH_SEP : '') + @name
|
32
|
-
@spin = ( @parent ? @parent.spin : self )
|
33
|
-
if @parent
|
34
|
-
@parent.add_iota self
|
35
|
-
@spin.add_to_world self if @spin.is_a? Iotas::Spin
|
36
|
-
end
|
37
|
-
end
|
38
|
-
#
|
39
|
-
attr_reader :name, :path, :spin
|
40
|
-
attr_accessor :viewer, :parent
|
41
|
-
#
|
42
|
-
def start!
|
43
|
-
# override this to initialize your object on system start
|
44
|
-
end
|
45
|
-
#
|
46
|
-
def stop!
|
47
|
-
# override this to initialize your object on system stop
|
48
|
-
end
|
49
|
-
#
|
50
|
-
def hibernate!
|
51
|
-
# override this to save your object state on hibernate
|
52
|
-
{}
|
53
|
-
end
|
54
|
-
#
|
55
|
-
def resume! o
|
56
|
-
# override this to restore your object state on resume
|
57
|
-
end
|
58
|
-
#
|
59
|
-
def receive_p p
|
60
|
-
raise NoMethodError.new "receive_p(p) must be overridden"
|
61
|
-
end
|
62
|
-
#
|
63
|
-
end
|
64
|
-
#
|
65
|
-
end
|
66
|
-
#
|
67
|
-
# EOF
|
data/lib/iotas/link.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
# Copyright 2012 Jérémy Zurcher <jeremy@asynk.ch>
|
5
|
-
#
|
6
|
-
# This file is part of iotas.
|
7
|
-
#
|
8
|
-
# iotas is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Affero General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# iotas is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Affero General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Affero General Public License
|
19
|
-
# along with iotas. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
|
21
|
-
#
|
22
|
-
module Iotas
|
23
|
-
#
|
24
|
-
LNK_SRC = 'edoors_lnk_src'.freeze
|
25
|
-
LNK_DSTS = 'edoors_lnk_dsts'.freeze
|
26
|
-
LNK_FIELDS = 'edoors_lnk_fields'.freeze
|
27
|
-
LNK_CONDF = 'edoors_lnk_condf'.freeze
|
28
|
-
LNK_CONDV = 'edoors_lnk_condv'.freeze
|
29
|
-
#
|
30
|
-
class Link
|
31
|
-
#
|
32
|
-
def initialize src, dsts, fields=nil, cond_fields=nil, cond_value=nil
|
33
|
-
@src = src # link source name
|
34
|
-
@dsts = dsts # , separated destinations to apply to the particle on linking success
|
35
|
-
@fields = fields # , separated fields to apply to the particle on linking success
|
36
|
-
@cond_fields = cond_fields # , separated fields used to generate the link value with particle payload
|
37
|
-
@cond_value = cond_value # value which will be compared to the particle link value to link or not
|
38
|
-
@door = nil # pointer to the source
|
39
|
-
end
|
40
|
-
#
|
41
|
-
def to_json *a
|
42
|
-
{
|
43
|
-
'kls' => self.class.name,
|
44
|
-
'src' => @src,
|
45
|
-
'dsts' => @dsts,
|
46
|
-
'fields' => @fields,
|
47
|
-
'cond_fields' => @cond_fields,
|
48
|
-
'cond_value' => @cond_value
|
49
|
-
}.to_json *a
|
50
|
-
end
|
51
|
-
#
|
52
|
-
def self.json_create o
|
53
|
-
raise Iotas::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
|
54
|
-
self.new o['src'], o['dsts'], o['fields'], o['cond_fields'], o['cond_value']
|
55
|
-
end
|
56
|
-
#
|
57
|
-
def self.from_particle_data p
|
58
|
-
Iotas::Link.new(p.get_data(Iotas::LNK_SRC), p.get_data(Iotas::LNK_DSTS),
|
59
|
-
p.get_data(Iotas::LNK_FIELDS), p.get_data(Iotas::LNK_CONDF),
|
60
|
-
p.get_data(Iotas::LNK_CONDV))
|
61
|
-
end
|
62
|
-
#
|
63
|
-
attr_accessor :door
|
64
|
-
attr_reader :src, :dsts, :fields, :cond_fields, :cond_value
|
65
|
-
#
|
66
|
-
end
|
67
|
-
#
|
68
|
-
end
|
69
|
-
#
|
70
|
-
# EOF
|