pione 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. data/.gitignore +3 -2
  2. data/History.txt +6 -0
  3. data/Rakefile +1 -1
  4. data/bin/pione-broker +1 -1
  5. data/bin/pione-clean +1 -1
  6. data/bin/pione-client +1 -1
  7. data/bin/pione-log +1 -1
  8. data/bin/pione-relay +1 -1
  9. data/bin/pione-relay-account-db +1 -1
  10. data/bin/pione-relay-client-db +1 -1
  11. data/bin/pione-syntax-checker +1 -1
  12. data/bin/pione-task-worker +1 -1
  13. data/bin/pione-tuple-space-provider +1 -1
  14. data/bin/pione-tuple-space-receiver +1 -1
  15. data/bin/pione-tuple-space-viewer +1 -1
  16. data/bin/pione-val +1 -1
  17. data/example/CTFCorrection/CTFCorrection.pione +78 -0
  18. data/example/CTFCorrection/package.yml +1 -0
  19. data/example/HelloWorld/scenario/output/message.txt +1 -0
  20. data/example/LoopByTouch/LoopByTouch.pione +10 -18
  21. data/example/LoopByTouch/PairLoop.pione +18 -0
  22. data/example/LoopByTouch/SingleLoop.pione +5 -0
  23. data/example/LoopByTouch/TripletLoop.pione +24 -0
  24. data/example/MakePair/scenario/output/comb-1-2.pair +0 -0
  25. data/example/MakePair/scenario/output/comb-1-3.pair +0 -0
  26. data/example/MakePair/scenario/output/comb-1-4.pair +0 -0
  27. data/example/MakePair/scenario/output/comb-1-5.pair +0 -0
  28. data/example/MakePair/scenario/output/comb-2-3.pair +0 -0
  29. data/example/MakePair/scenario/output/comb-2-4.pair +0 -0
  30. data/example/MakePair/scenario/output/comb-2-5.pair +0 -0
  31. data/example/MakePair/scenario/output/comb-3-4.pair +0 -0
  32. data/example/MakePair/scenario/output/comb-3-5.pair +0 -0
  33. data/example/MakePair/scenario/output/comb-4-5.pair +0 -0
  34. data/example/MakePair/scenario/output/perm-1-2.pair +0 -0
  35. data/example/MakePair/scenario/output/perm-1-3.pair +0 -0
  36. data/example/MakePair/scenario/output/perm-1-4.pair +0 -0
  37. data/example/MakePair/scenario/output/perm-1-5.pair +0 -0
  38. data/example/MakePair/scenario/output/perm-2-1.pair +0 -0
  39. data/example/MakePair/scenario/output/perm-2-3.pair +0 -0
  40. data/example/MakePair/scenario/output/perm-2-4.pair +0 -0
  41. data/example/MakePair/scenario/output/perm-2-5.pair +0 -0
  42. data/example/MakePair/scenario/output/perm-3-1.pair +0 -0
  43. data/example/MakePair/scenario/output/perm-3-2.pair +0 -0
  44. data/example/MakePair/scenario/output/perm-3-4.pair +0 -0
  45. data/example/MakePair/scenario/output/perm-3-5.pair +0 -0
  46. data/example/MakePair/scenario/output/perm-4-1.pair +0 -0
  47. data/example/MakePair/scenario/output/perm-4-2.pair +0 -0
  48. data/example/MakePair/scenario/output/perm-4-3.pair +0 -0
  49. data/example/MakePair/scenario/output/perm-4-5.pair +0 -0
  50. data/example/MakePair/scenario/output/perm-5-1.pair +0 -0
  51. data/example/MakePair/scenario/output/perm-5-2.pair +0 -0
  52. data/example/MakePair/scenario/output/perm-5-3.pair +0 -0
  53. data/example/MakePair/scenario/output/perm-5-4.pair +0 -0
  54. data/example/MakePair/scenario/output/succ-1-2.pair +0 -0
  55. data/example/MakePair/scenario/output/succ-2-3.pair +0 -0
  56. data/example/MakePair/scenario/output/succ-3-4.pair +0 -0
  57. data/example/MakePair/scenario/output/succ-4-5.pair +0 -0
  58. data/example/SyntaxError/output_line_error.pione +6 -0
  59. data/example/WorkflowPatterns/38_GeneralSynchronizingMerge/GeneralSynchronizingMerge.pione +94 -0
  60. data/lib/pione.rb +1 -10
  61. data/lib/pione/agent/process-manager.rb +6 -5
  62. data/lib/pione/agent/rule-provider.rb +7 -9
  63. data/lib/pione/agent/task-worker.rb +1 -1
  64. data/lib/pione/command.rb +1 -0
  65. data/lib/pione/command/basic-command.rb +12 -77
  66. data/lib/pione/command/child-process.rb +19 -13
  67. data/lib/pione/command/daemon-process.rb +0 -9
  68. data/lib/pione/command/front-owner-command.rb +0 -6
  69. data/lib/pione/command/option.rb +243 -0
  70. data/lib/pione/command/pione-broker.rb +10 -5
  71. data/lib/pione/command/pione-clean.rb +4 -0
  72. data/lib/pione/command/pione-client.rb +257 -210
  73. data/lib/pione/command/pione-log.rb +38 -19
  74. data/lib/pione/command/pione-relay-account-db.rb +42 -17
  75. data/lib/pione/command/pione-relay-client-db.rb +35 -14
  76. data/lib/pione/command/pione-relay.rb +16 -8
  77. data/lib/pione/command/pione-syntax-checker.rb +33 -13
  78. data/lib/pione/command/pione-task-worker.rb +26 -23
  79. data/lib/pione/command/pione-tuple-space-provider.rb +8 -17
  80. data/lib/pione/command/pione-tuple-space-receiver.rb +13 -3
  81. data/lib/pione/command/pione-tuple-space-viewer.rb +42 -23
  82. data/lib/pione/command/pione-val.rb +15 -7
  83. data/lib/pione/component/document.rb +49 -70
  84. data/lib/pione/component/package.rb +125 -83
  85. data/lib/pione/location/basic-location.rb +1 -0
  86. data/lib/pione/model/assignment.rb +11 -0
  87. data/lib/pione/model/parameters.rb +10 -0
  88. data/lib/pione/model/variable.rb +14 -0
  89. data/lib/pione/parser/common-parser.rb +4 -0
  90. data/lib/pione/parser/document-parser.rb +4 -3
  91. data/lib/pione/parser/rule-definition-parser.rb +2 -1
  92. data/lib/pione/patch/rinda-patch.rb +1 -1
  93. data/lib/pione/rule-handler/action-handler.rb +6 -1
  94. data/lib/pione/rule-handler/basic-handler.rb +0 -6
  95. data/lib/pione/rule-handler/flow-handler.rb +14 -9
  96. data/lib/pione/system/global.rb +3 -0
  97. data/lib/pione/system/package-cache.rb +18 -0
  98. data/lib/pione/transformer/document-transformer.rb +26 -3
  99. data/lib/pione/transformer/rule-definition-transformer.rb +10 -2
  100. data/lib/pione/tuple-space/presence-notifier.rb +4 -3
  101. data/lib/pione/uri-scheme.rb +11 -0
  102. data/lib/pione/uri-scheme/git-scheme.rb +12 -0
  103. data/lib/pione/util.rb +2 -0
  104. data/lib/pione/util/package-parameters-list.rb +32 -0
  105. data/lib/pione/util/process-info.rb +21 -0
  106. data/lib/pione/version.rb +1 -1
  107. data/pione.gemspec +1 -1
  108. data/test/agent/spec_rule-provider.rb +57 -44
  109. data/test/command/command-behavior.rb +15 -0
  110. data/test/command/spec_pione-client.rb +56 -0
  111. data/test/command/spec_pione-val.domain.dump +0 -0
  112. data/test/command/spec_pione-val.rb +22 -0
  113. data/test/component/spec_document.pione +51 -0
  114. data/test/component/spec_document.rb +41 -70
  115. data/test/component/spec_package.rb +18 -3
  116. data/test/parser/spec_document-parser.yml +15 -0
  117. data/test/parser/spec_rule-definition-parser.yml +7 -2
  118. data/test/rule-handler/spec_action-handler.rb +6 -6
  119. data/test/rule-handler/spec_flow-handler.pione +25 -0
  120. data/test/rule-handler/spec_flow-handler.rb +35 -95
  121. data/test/rule-handler/spec_update-criteria.rb +2 -2
  122. data/test/test-util.rb +68 -4
  123. data/test/transformer/spec_block-transformer.rb +1 -1
  124. data/test/transformer/spec_document-transformer.rb +50 -0
  125. data/test/transformer/spec_expr-transformer.rb +1 -1
  126. data/test/transformer/spec_flow-element-transformer.rb +13 -13
  127. data/test/transformer/spec_literal-transformer.rb +1 -1
  128. data/test/transformer/spec_rule-definition-transformer.rb +31 -19
  129. data/test/uri-scheme/spec_git-scheme.rb +20 -0
  130. data/test/util/spec_id.rb +6 -6
  131. data/test/util/spec_package-parameters-list.rb +59 -0
  132. data/test/util/spec_package-parameters-list_1.pione +17 -0
  133. data/test/util/spec_package-parameters-list_2.pione +13 -0
  134. data/test/util/spec_package-parameters-list_3.pione +12 -0
  135. data/test/util/spec_package-parameters-list_4.pione +6 -0
  136. data/test/util/spec_process-info.rb +56 -0
  137. metadata +79 -16
  138. data/lib/pione/option.rb +0 -13
  139. data/lib/pione/option/child-process-option.rb +0 -19
  140. data/lib/pione/option/common-option.rb +0 -31
  141. data/lib/pione/option/option-interface.rb +0 -73
  142. data/lib/pione/option/presence-notifier-option.rb +0 -16
  143. data/lib/pione/option/task-worker-owner-option.rb +0 -24
  144. data/lib/pione/option/tuple-space-provider-option.rb +0 -28
  145. data/lib/pione/option/tuple-space-provider-owner-option.rb +0 -18
  146. data/lib/pione/option/tuple-space-receiver-option.rb +0 -8
data/lib/pione/option.rb DELETED
@@ -1,13 +0,0 @@
1
- module Pione
2
- # Option is a name space for command option set modules.
3
- module Option; end
4
- end
5
-
6
- require 'pione/option/option-interface'
7
- require 'pione/option/common-option'
8
- require 'pione/option/child-process-option'
9
- require 'pione/option/presence-notifier-option'
10
- require 'pione/option/tuple-space-provider-option'
11
- require 'pione/option/tuple-space-provider-owner-option'
12
- require 'pione/option/tuple-space-receiver-option'
13
- require 'pione/option/task-worker-owner-option'
@@ -1,19 +0,0 @@
1
- module Pione
2
- module Option
3
- # ChildProcessOption provides options for child process like
4
- # pione-task-worker or pione-tuple-space-receiver.
5
- module ChildProcessOption
6
- extend OptionInterface
7
-
8
- # --parent-front
9
- option('--parent-front=URI', 'set parent front URI') do |data, uri|
10
- data[:parent_front] = DRbObject.new_with_uri(uri)
11
- end
12
-
13
- # --no-parent
14
- option('--no-parent', 'turn on no parent mode') do
15
- data[:no_parent_mode] = true
16
- end
17
- end
18
- end
19
- end
@@ -1,31 +0,0 @@
1
- module Pione
2
- module Option
3
- # CommonOption provides common options for pione commands.
4
- module CommonOption
5
- extend OptionInterface
6
-
7
- # --debug
8
- option('-d', '--debug', "turn on debug mode") do |data, name|
9
- Pione.debug_mode = true
10
- end
11
-
12
- # --show-communication
13
- option('--show-communication', "show object communication") do |data, show|
14
- Global.show_communication = true
15
- end
16
-
17
- # --color
18
- option('--[no-]color', 'turn on/off color mode') do |data, str|
19
- bool = nil
20
- bool = true if str == "true"
21
- bool = false if str == "false"
22
- if bool.nil?
23
- puts "invalid color option: %s" % bool
24
- exit!
25
- end
26
- # disable rainbow
27
- Sickill::Rainbow.enabled = bool
28
- end
29
- end
30
- end
31
- end
@@ -1,73 +0,0 @@
1
- module Pione
2
- module Option
3
- # OptionInterface provides basic methods for option modules. All option
4
- # modules should be extended by this.
5
- module OptionInterface
6
- # Make an array of definitions.
7
- #
8
- # @api private
9
- def self.extended(obj)
10
- obj.instance_variable_set(:@definitions, [])
11
- obj.instance_variable_set(:@default_table, {})
12
- obj.instance_variable_set(:@validators, [])
13
- end
14
-
15
- attr_reader :definitions
16
- attr_reader :default_table
17
- attr_reader :validators
18
-
19
- # Define default value of the option data set.
20
- #
21
- # @param name [Symbol]
22
- # option data key
23
- # @param value [Object]
24
- # option data value
25
- # @return [void]
26
- def default(name, value)
27
- @default_table[name] = value
28
- end
29
-
30
- # Define a new option for the command.
31
- #
32
- # @param args [Array]
33
- # OptionParser arguments
34
- # @param b [Proc]
35
- # option action
36
- # @return [void]
37
- def option(*args, &b)
38
- @definitions << [args, b]
39
- end
40
-
41
- # Remove the option.
42
- #
43
- # @param b [Proc]
44
- # remove options that match proc's result
45
- # @return [void]
46
- def remove_option(&b)
47
- @definitions.select! do |definition|
48
- not(b.call(definition))
49
- end
50
- end
51
-
52
- # Install the option module.
53
- #
54
- # @param mod [Module]
55
- # PIONE's option set modules
56
- # @return [void]
57
- def use(mod)
58
- @definitions += mod.definitions
59
- @default_table.merge!(mod.default_table)
60
- @validators += mod.validators
61
- end
62
-
63
- # Define validation of the option set.
64
- #
65
- # @param b [Proc]
66
- # validation content
67
- # @return [void]
68
- def validate(&b)
69
- @validators << b
70
- end
71
- end
72
- end
73
- end
@@ -1,16 +0,0 @@
1
- module Pione
2
- module Option
3
- # PresenceNotifierOption provides options for presence notifiers.
4
- module PresenceNotifierOption
5
- extend OptionInterface
6
-
7
- # --show-presence-notifier
8
- option(
9
- "--show-presence-notifier",
10
- "show presence notifier informations"
11
- ) do |data|
12
- Global.show_presence_notifier = true
13
- end
14
- end
15
- end
16
- end
@@ -1,24 +0,0 @@
1
- module Pione
2
- module Option
3
- # TaskWorkerOwnerOption provides options for commands that make task
4
- # workers. Options are:
5
- #
6
- # - task-worker
7
- # - features
8
- module TaskWorkerOwnerOption
9
- extend OptionInterface
10
-
11
- default :task_worker, Agent::TaskWorker.default_number
12
-
13
- # --task-worker
14
- option('-t N', '--task-worker=N', 'set task worker number that this process creates') do |data, n|
15
- data[:task_worker] = n.to_i
16
- end
17
-
18
- # --features
19
- option('--features=FEATURES', 'set features') do |data, features|
20
- data[:features] = features
21
- end
22
- end
23
- end
24
- end
@@ -1,28 +0,0 @@
1
- module Pione
2
- module Option
3
- # TupleSpaceProviderOption provides options for commands that make tuple
4
- # space provider agent.
5
- module TupleSpaceProviderOption
6
- extend OptionInterface
7
- use PresenceNotifierOption
8
-
9
- # --presence-notification-address
10
- option(
11
- "--presence-notification-address=255.255.255.255:%s" % Global.presence_port,
12
- "set the address for sending presence notifier"
13
- ) do |data, address|
14
- # clear addresses at first time
15
- unless @__option_notifier_address__
16
- @__option_notifier_address__ = true
17
- Global.presence_notification_addresses = []
18
- end
19
- # add the address
20
- address = address =~ /^broadcast/ ? address : "broadcast://%s" % address
21
- uri = URI.parse(address)
22
- uri.host = "255.255.255.255" if uri.host.nil?
23
- uri.port = Global.presence_port if uri.port.nil?
24
- Global.presence_notification_addresses << uri
25
- end
26
- end
27
- end
28
- end
@@ -1,18 +0,0 @@
1
- module Pione
2
- module Option
3
- # TupleSpaceProviderOption provides options for commands that make tuple
4
- # space provider agent.
5
- module TupleSpaceProviderOwnerOption
6
- extend OptionInterface
7
- use TupleSpaceProviderOption
8
-
9
- # --without-tuple-space-provider
10
- option(
11
- '--without-tuple-space-provider',
12
- 'process without tuple space provider'
13
- ) do |data|
14
- data[:without_tuple_space_provider] = true
15
- end
16
- end
17
- end
18
- end
@@ -1,8 +0,0 @@
1
- module Pione
2
- module Option
3
- # TupleSpaceReceiverOption provides options for tuple space receiver.
4
- module TupleSpaceReceiverOption
5
- extend OptionInterface
6
- end
7
- end
8
- end