cirrocumulus 0.6.3 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/README.rdoc +1 -22
  2. data/lib/cirrocumulus.rb +8 -2
  3. data/lib/cirrocumulus/{message.rb → agents/message.rb} +0 -0
  4. data/lib/cirrocumulus/channels.rb +129 -0
  5. data/lib/cirrocumulus/channels/jabber.rb +168 -0
  6. data/lib/cirrocumulus/environment.rb +46 -0
  7. data/lib/cirrocumulus/facts.rb +135 -0
  8. data/lib/cirrocumulus/identifier.rb +84 -0
  9. data/lib/cirrocumulus/ontology.rb +333 -49
  10. data/lib/cirrocumulus/pattern_matching.rb +175 -0
  11. data/lib/cirrocumulus/remote_console.rb +29 -0
  12. data/lib/cirrocumulus/rule_queue.rb +69 -0
  13. data/lib/cirrocumulus/rules/engine.rb +7 -5
  14. data/lib/cirrocumulus/rules/fact.rb +22 -0
  15. data/lib/cirrocumulus/rules/pattern_matcher.rb +19 -0
  16. data/lib/cirrocumulus/rules/run_queue.rb +1 -0
  17. data/lib/cirrocumulus/saga.rb +44 -25
  18. data/lib/console.rb +96 -0
  19. metadata +79 -72
  20. data/.document +0 -5
  21. data/.idea/.name +0 -1
  22. data/.idea/.rakeTasks +0 -7
  23. data/.idea/cirrocumulus.iml +0 -87
  24. data/.idea/encodings.xml +0 -5
  25. data/.idea/misc.xml +0 -5
  26. data/.idea/modules.xml +0 -9
  27. data/.idea/scopes/scope_settings.xml +0 -5
  28. data/.idea/vcs.xml +0 -7
  29. data/.idea/workspace.xml +0 -614
  30. data/Gemfile +0 -18
  31. data/Gemfile.lock +0 -43
  32. data/Rakefile +0 -37
  33. data/VERSION +0 -1
  34. data/cirrocumulus.gemspec +0 -106
  35. data/lib/.gitignore +0 -5
  36. data/lib/cirrocumulus/agent_wrapper.rb +0 -67
  37. data/lib/cirrocumulus/jabber_bus.rb +0 -140
  38. data/lib/cirrocumulus/rule_engine.rb +0 -2
  39. data/lib/cirrocumulus/rule_server.rb +0 -49
  40. data/test/Gemfile +0 -3
  41. data/test/Gemfile.lock +0 -27
  42. data/test/helper.rb +0 -18
  43. data/test/test.rb +0 -85
  44. data/test/test2.rb +0 -30
  45. data/test/test_cirrocumulus.rb +0 -7
@@ -0,0 +1,96 @@
1
+ require 'drb'
2
+ require 'rubygems'
3
+ require 'highline/import'
4
+
5
+ class CmConsole
6
+ def initialize
7
+ @cm = DRbObject.new_with_uri('druby://127.0.0.1:8112')
8
+ end
9
+
10
+ def list_inproc_agents
11
+ @cm.list_inproc_agents()
12
+ rescue DRb::DRbError => ex
13
+ []
14
+ end
15
+
16
+ def assert(identifier, data)
17
+ @cm.assert(identifier, data)
18
+ rescue DRb::DRbError => ex
19
+ end
20
+
21
+ def retract(identifier, data)
22
+ @cm.retract(identifier, data)
23
+ rescue DRb::DRbError => ex
24
+ end
25
+
26
+ def dump_kb(identifier)
27
+ @cm.dump_kb(identifier)
28
+ rescue DRb::DRbError => ex
29
+ []
30
+ end
31
+
32
+ def dump_sagas(identifier)
33
+ @cm.dump_sagas(identifier)
34
+ rescue DRb::DRbError => ex
35
+ []
36
+ end
37
+ end
38
+
39
+ DRb.start_service
40
+ cm = CmConsole.new
41
+
42
+ loop do
43
+ line = ask('cirrocumulus> ') {|q| q.readline = true}
44
+ args = line.split(" ")
45
+ cmd = args.first
46
+
47
+ case cmd
48
+ when 'quit'
49
+ break
50
+
51
+ when 'list'
52
+ puts "Inproc agent instances:"
53
+ inproc = cm.list_inproc_agents
54
+ inproc.each do |identifier|
55
+ puts "* %s" % identifier
56
+ end
57
+
58
+ when 'assert'
59
+ agent = args[1].to_s
60
+ 2.times { args.delete_at(0) }
61
+ data = args.join(' ')
62
+ puts "assert %s to %s" % [data, agent]
63
+ cm.assert(agent, data)
64
+
65
+ when 'retract'
66
+ agent = args[1].to_s
67
+ 2.times { args.delete_at(0) }
68
+ data = args.join(' ')
69
+ puts "retract %s from %s" % [data, agent]
70
+ cm.retract(agent, data)
71
+
72
+ when 'kb'
73
+ agent = args[1].to_s
74
+ puts "dumping KB of %s:" % agent
75
+ facts = cm.dump_kb(agent)
76
+ facts.each do |fact|
77
+ puts "* %s" % fact
78
+ end
79
+
80
+ puts "KB is yet empty." if facts.empty?
81
+
82
+ when 'sagas'
83
+ agent = args[1].to_s
84
+ puts "dumping sagas of %s:" % agent
85
+ sagas = cm.dump_sagas(agent)
86
+ sagas.each do |saga|
87
+ puts "* %s" % saga
88
+ end
89
+
90
+ puts "No active sagas right now." if sagas.empty?
91
+
92
+
93
+ else
94
+ puts "Unknown command: %s" % cmd
95
+ end
96
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cirrocumulus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,33 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-23 00:00:00.000000000 Z
12
+ date: 2012-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: activesupport
16
- requirement: &85563920 !ruby/object:Gem::Requirement
15
+ name: log4r
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.3.11
21
+ version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *85563920
25
- - !ruby/object:Gem::Dependency
26
- name: log4r
27
- requirement: &85563510 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
28
25
  none: false
29
26
  requirements:
30
- - - ~>
27
+ - - ! '>='
31
28
  - !ruby/object:Gem::Version
32
- version: 1.1.9
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *85563510
29
+ version: '0'
36
30
  - !ruby/object:Gem::Dependency
37
31
  name: systemu
38
- requirement: &85563140 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
34
  requirements:
41
35
  - - ! '>='
@@ -43,21 +37,31 @@ dependencies:
43
37
  version: '0'
44
38
  type: :runtime
45
39
  prerelease: false
46
- version_requirements: *85563140
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
47
46
  - !ruby/object:Gem::Dependency
48
47
  name: xmpp4r
49
- requirement: &85562690 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
50
49
  none: false
51
50
  requirements:
52
- - - ~>
51
+ - - ! '>='
53
52
  - !ruby/object:Gem::Version
54
- version: '0.5'
53
+ version: '0'
55
54
  type: :runtime
56
55
  prerelease: false
57
- version_requirements: *85562690
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
58
62
  - !ruby/object:Gem::Dependency
59
63
  name: xmpp4r-simple
60
- requirement: &85562350 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
61
65
  none: false
62
66
  requirements:
63
67
  - - ! '>='
@@ -65,21 +69,15 @@ dependencies:
65
69
  version: '0'
66
70
  type: :runtime
67
71
  prerelease: false
68
- version_requirements: *85562350
69
- - !ruby/object:Gem::Dependency
70
- name: eventmachine
71
- requirement: &85561900 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
72
73
  none: false
73
74
  requirements:
74
75
  - - ! '>='
75
76
  - !ruby/object:Gem::Version
76
77
  version: '0'
77
- type: :runtime
78
- prerelease: false
79
- version_requirements: *85561900
80
78
  - !ruby/object:Gem::Dependency
81
79
  name: deil_sexpistol
82
- requirement: &85577400 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
83
81
  none: false
84
82
  requirements:
85
83
  - - ! '>='
@@ -87,10 +85,15 @@ dependencies:
87
85
  version: '0'
88
86
  type: :runtime
89
87
  prerelease: false
90
- version_requirements: *85577400
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
91
94
  - !ruby/object:Gem::Dependency
92
95
  name: guid
93
- requirement: &85576890 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
94
97
  none: false
95
98
  requirements:
96
99
  - - ! '>='
@@ -98,10 +101,15 @@ dependencies:
98
101
  version: '0'
99
102
  type: :runtime
100
103
  prerelease: false
101
- version_requirements: *85576890
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
102
110
  - !ruby/object:Gem::Dependency
103
111
  name: rdoc
104
- requirement: &85576560 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
105
113
  none: false
106
114
  requirements:
107
115
  - - ~>
@@ -109,21 +117,31 @@ dependencies:
109
117
  version: '3.12'
110
118
  type: :development
111
119
  prerelease: false
112
- version_requirements: *85576560
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '3.12'
113
126
  - !ruby/object:Gem::Dependency
114
127
  name: bundler
115
- requirement: &85575850 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
116
129
  none: false
117
130
  requirements:
118
- - - ~>
131
+ - - ! '>='
119
132
  - !ruby/object:Gem::Version
120
- version: 1.0.0
133
+ version: '0'
121
134
  type: :development
122
135
  prerelease: false
123
- version_requirements: *85575850
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
124
142
  - !ruby/object:Gem::Dependency
125
143
  name: jeweler
126
- requirement: &85575310 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
127
145
  none: false
128
146
  requirements:
129
147
  - - ~>
@@ -131,7 +149,12 @@ dependencies:
131
149
  version: 1.8.3
132
150
  type: :development
133
151
  prerelease: false
134
- version_requirements: *85575310
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 1.8.3
135
158
  description: Engine for building your own agents, providing you base functionality
136
159
  for loading ontologies, communicating with other agents and parsing FIPA-ACL messages
137
160
  email: deil@mneko.net
@@ -141,42 +164,26 @@ extra_rdoc_files:
141
164
  - LICENSE.txt
142
165
  - README.rdoc
143
166
  files:
144
- - .document
145
- - .idea/.name
146
- - .idea/.rakeTasks
147
- - .idea/cirrocumulus.iml
148
- - .idea/encodings.xml
149
- - .idea/misc.xml
150
- - .idea/modules.xml
151
- - .idea/scopes/scope_settings.xml
152
- - .idea/vcs.xml
153
- - .idea/workspace.xml
154
- - Gemfile
155
- - Gemfile.lock
156
- - LICENSE.txt
157
- - README.rdoc
158
- - Rakefile
159
- - VERSION
160
- - cirrocumulus.gemspec
161
- - lib/.gitignore
162
167
  - lib/cirrocumulus.rb
163
- - lib/cirrocumulus/agent.rb
164
- - lib/cirrocumulus/agent_wrapper.rb
165
- - lib/cirrocumulus/jabber_bus.rb
168
+ - lib/cirrocumulus/agents/message.rb
169
+ - lib/cirrocumulus/channels.rb
170
+ - lib/cirrocumulus/channels/jabber.rb
171
+ - lib/cirrocumulus/environment.rb
172
+ - lib/cirrocumulus/facts.rb
173
+ - lib/cirrocumulus/identifier.rb
166
174
  - lib/cirrocumulus/logger.rb
167
- - lib/cirrocumulus/message.rb
168
175
  - lib/cirrocumulus/ontology.rb
169
- - lib/cirrocumulus/rule_engine.rb
170
- - lib/cirrocumulus/rule_server.rb
176
+ - lib/cirrocumulus/pattern_matching.rb
177
+ - lib/cirrocumulus/remote_console.rb
178
+ - lib/cirrocumulus/rule_queue.rb
171
179
  - lib/cirrocumulus/rules/engine.rb
180
+ - lib/cirrocumulus/rules/fact.rb
181
+ - lib/cirrocumulus/rules/pattern_matcher.rb
172
182
  - lib/cirrocumulus/rules/run_queue.rb
173
183
  - lib/cirrocumulus/saga.rb
174
- - test/Gemfile
175
- - test/Gemfile.lock
176
- - test/helper.rb
177
- - test/test.rb
178
- - test/test2.rb
179
- - test/test_cirrocumulus.rb
184
+ - lib/console.rb
185
+ - LICENSE.txt
186
+ - README.rdoc
180
187
  homepage: http://github.com/deil/cirrocumulus
181
188
  licenses:
182
189
  - GPL-2
@@ -198,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
205
  version: '0'
199
206
  requirements: []
200
207
  rubyforge_project:
201
- rubygems_version: 1.8.10
208
+ rubygems_version: 1.8.24
202
209
  signing_key:
203
210
  specification_version: 3
204
211
  summary: Agent-based infrastructure management system
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
@@ -1 +0,0 @@
1
- cirrocumulus
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Settings><!--This file was automatically generated by Ruby plugin.
3
- You are allowed to:
4
- 1. Remove rake task
5
- 2. Add existing rake tasks
6
- To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gem into pkg/" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated file" fullCmd="clobber" taksId="clobber" /><RakeTask description="Remove RDoc HTML files" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Start IRB with all runtime dependencies loaded" fullCmd="console[script]" taksId="console[script]" /><RakeGroup description="" fullCmd="" taksId="gemcutter"><RakeTask description="Release gem to Gemcutter" fullCmd="gemcutter:release" taksId="release" /></RakeGroup><RakeTask description="Generate and validate gemspec" fullCmd="gemspec" taksId="gemspec" /><RakeGroup description="" fullCmd="" taksId="gemspec"><RakeTask description="Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem)" fullCmd="gemspec:debug" taksId="debug" /><RakeTask description="Regenerate the gemspec on the filesystem" fullCmd="gemspec:generate" taksId="generate" /><RakeTask description="Regenerate and validate gemspec, and then commits and pushes to git" fullCmd="gemspec:release" taksId="release" /><RakeTask description="Validates the gemspec on the filesystem" fullCmd="gemspec:validate" taksId="validate" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="git"><RakeTask description="Tag and push release to git" fullCmd="git:release" taksId="release" /></RakeGroup><RakeTask description="Build and install gem using `gem install`" fullCmd="install" taksId="install" /><RakeTask description="Build RDoc HTML files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Release gem" fullCmd="release" taksId="release" /><RakeTask description="Rebuild RDoc HTML files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Displays the current version" fullCmd="version" taksId="version" /><RakeGroup description="" fullCmd="" taksId="version"><RakeGroup description="" fullCmd="" taksId="bump"><RakeTask description="Bump the major version by 1" fullCmd="version:bump:major" taksId="major" /><RakeTask description="Bump the a minor version by 1" fullCmd="version:bump:minor" taksId="minor" /><RakeTask description="Bump the patch version by 1" fullCmd="version:bump:patch" taksId="patch" /></RakeGroup><RakeTask description="Writes out an explicit version" fullCmd="version:write" taksId="write" /></RakeGroup><RakeTask description="" fullCmd="console" taksId="console" /><RakeTask description="" fullCmd="gemspec_required" taksId="gemspec_required" /><RakeTask description="" fullCmd="rdoc/index.html" taksId="rdoc/index.html" /><RakeTask description="" fullCmd="version_required" taksId="version_required" /></RakeGroup></Settings>
@@ -1,87 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="GemRequirementsHolder" version="3">
4
- <requirement>
5
- <requirement>
6
- <dependency name="activesupport" version="2.3.11" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
7
- </requirement>
8
- <source from="Gemfile" />
9
- </requirement>
10
- <requirement>
11
- <requirement>
12
- <dependency name="bundler" version="1.0.0" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
13
- </requirement>
14
- <source from="Gemfile" />
15
- </requirement>
16
- <requirement>
17
- <requirement>
18
- <dependency name="deil_sexpistol" version="0" bound="GREATER_OR_EQUAL" lib="sexpistol" git="false" path="false" doRequire="true" />
19
- </requirement>
20
- <source from="Gemfile" />
21
- </requirement>
22
- <requirement>
23
- <requirement>
24
- <dependency name="eventmachine" version="0" bound="GREATER_OR_EQUAL" git="false" path="false" doRequire="true" />
25
- </requirement>
26
- <source from="Gemfile" />
27
- </requirement>
28
- <requirement>
29
- <requirement>
30
- <dependency name="jeweler" version="1.6.4" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
31
- </requirement>
32
- <source from="Gemfile" />
33
- </requirement>
34
- <requirement>
35
- <requirement>
36
- <dependency name="log4r" version="1.1.9" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
37
- </requirement>
38
- <source from="Gemfile" />
39
- </requirement>
40
- <requirement>
41
- <requirement>
42
- <dependency name="rcov" version="0" bound="GREATER_OR_EQUAL" git="false" path="false" doRequire="true" />
43
- </requirement>
44
- <source from="Gemfile" />
45
- </requirement>
46
- <requirement>
47
- <requirement>
48
- <dependency name="systemu" version="0" bound="GREATER_OR_EQUAL" git="false" path="false" doRequire="true" />
49
- </requirement>
50
- <source from="Gemfile" />
51
- </requirement>
52
- <requirement>
53
- <requirement>
54
- <dependency name="xmpp4r" version="0.5" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
55
- </requirement>
56
- <source from="Gemfile" />
57
- </requirement>
58
- <requirement>
59
- <requirement>
60
- <dependency name="xmpp4r-simple" version="0.8.8" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
61
- </requirement>
62
- <source from="Gemfile" />
63
- </requirement>
64
- </component>
65
- <component name="NewModuleRootManager">
66
- <content url="file://$MODULE_DIR$">
67
- <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
68
- </content>
69
- <orderEntry type="inheritedJdk" />
70
- <orderEntry type="sourceFolder" forTests="false" />
71
- <orderEntry type="library" scope="PROVIDED" name="activesupport (v2.3.14, RVM: ruby-1.9.3-p0) [gem]" level="application" />
72
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.0.21, RVM: ruby-1.9.3-p0) [gem]" level="application" />
73
- <orderEntry type="library" scope="PROVIDED" name="deil_sexpistol (v0.0.8, RVM: ruby-1.9.3-p0) [gem]" level="application" />
74
- <orderEntry type="library" scope="PROVIDED" name="eventmachine (v0.12.10, RVM: ruby-1.9.3-p0) [gem]" level="application" />
75
- <orderEntry type="library" scope="PROVIDED" name="git (v1.2.5, RVM: ruby-1.9.3-p0) [gem]" level="application" />
76
- <orderEntry type="library" scope="PROVIDED" name="guid (v0.1.1, RVM: ruby-1.9.3-p0) [gem]" level="application" />
77
- <orderEntry type="library" scope="PROVIDED" name="jeweler (v1.8.3, RVM: ruby-1.9.3-p0) [gem]" level="application" />
78
- <orderEntry type="library" scope="PROVIDED" name="json (v1.6.5, RVM: ruby-1.9.3-p0) [gem]" level="application" />
79
- <orderEntry type="library" scope="PROVIDED" name="log4r (v1.1.10, RVM: ruby-1.9.3-p0) [gem]" level="application" />
80
- <orderEntry type="library" scope="PROVIDED" name="rake (v0.9.2.2, RVM: ruby-1.9.3-p0) [gem]" level="application" />
81
- <orderEntry type="library" scope="PROVIDED" name="rdoc (v3.12, RVM: ruby-1.9.3-p0) [gem]" level="application" />
82
- <orderEntry type="library" scope="PROVIDED" name="systemu (v2.4.2, RVM: ruby-1.9.3-p0) [gem]" level="application" />
83
- <orderEntry type="library" scope="PROVIDED" name="xmpp4r (v0.5, RVM: ruby-1.9.3-p0) [gem]" level="application" />
84
- <orderEntry type="library" scope="PROVIDED" name="xmpp4r-simple (v0.8.8, RVM: ruby-1.9.3-p0) [gem]" level="application" />
85
- </component>
86
- </module>
87
-