pione 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (304) hide show
  1. data/.gitignore +2 -0
  2. data/.s3cfg +42 -0
  3. data/.travis.yml +18 -4
  4. data/.yardopts +1 -0
  5. data/Gemfile +3 -0
  6. data/History.txt +14 -0
  7. data/Procfile +7 -0
  8. data/Rakefile +25 -0
  9. data/bin/pione-interactive +6 -0
  10. data/bin/{pione-compiler → pione-notification-listener} +1 -1
  11. data/bin/{pione-broker → pione-task-worker-broker} +1 -1
  12. data/doc/man/pione-list-param.md +36 -0
  13. data/example/ActionError/ActionError.pione +9 -0
  14. data/example/ActionError/pione-package.json +15 -0
  15. data/example/CountChar/CountChar.pione +1 -1
  16. data/example/ScoreAggregation/ScoreAggregation.pione +1 -1
  17. data/example/Touch/pione-package.json +15 -0
  18. data/lib/pione.rb +12 -0
  19. data/lib/pione/agent.rb +3 -3
  20. data/lib/pione/agent/basic-agent.rb +10 -4
  21. data/lib/pione/agent/input-generator.rb +3 -3
  22. data/lib/pione/agent/{process-manager.rb → job-manager.rb} +10 -7
  23. data/lib/pione/agent/job-terminator.rb +2 -2
  24. data/lib/pione/agent/logger.rb +3 -3
  25. data/lib/pione/agent/messenger.rb +20 -9
  26. data/lib/pione/agent/notification-listener.rb +88 -0
  27. data/lib/pione/agent/task-worker-broker.rb +84 -0
  28. data/lib/pione/agent/task-worker.rb +3 -2
  29. data/lib/pione/agent/tuple-space-client.rb +1 -0
  30. data/lib/pione/agent/tuple-space-provider.rb +17 -35
  31. data/lib/pione/command.rb +33 -15
  32. data/lib/pione/command/action.rb +105 -0
  33. data/lib/pione/command/basic-command.rb +34 -376
  34. data/lib/pione/command/command-exception.rb +12 -11
  35. data/lib/pione/command/common.rb +198 -0
  36. data/lib/pione/command/option.rb +159 -204
  37. data/lib/pione/command/pione-action-exec.rb +85 -0
  38. data/lib/pione/command/pione-action-list.rb +43 -19
  39. data/lib/pione/command/pione-action-print.rb +79 -0
  40. data/lib/pione/command/pione-action.rb +8 -67
  41. data/lib/pione/command/pione-clean.rb +88 -68
  42. data/lib/pione/command/pione-client.rb +475 -332
  43. data/lib/pione/command/pione-command.rb +14 -31
  44. data/lib/pione/command/pione-compile.rb +90 -0
  45. data/lib/pione/command/pione-config-get.rb +53 -0
  46. data/lib/pione/command/pione-config-list.rb +64 -0
  47. data/lib/pione/command/pione-config-set.rb +59 -0
  48. data/lib/pione/command/pione-config-unset.rb +50 -0
  49. data/lib/pione/command/pione-config.rb +61 -0
  50. data/lib/pione/command/pione-diagnosis-notification.rb +235 -0
  51. data/lib/pione/command/pione-diagnosis.rb +21 -0
  52. data/lib/pione/command/pione-interactive.rb +188 -0
  53. data/lib/pione/command/pione-lang-check-syntax.rb +163 -0
  54. data/lib/pione/command/pione-lang-interactive.rb +146 -0
  55. data/lib/pione/command/pione-lang.rb +22 -0
  56. data/lib/pione/command/pione-log-format.rb +163 -0
  57. data/lib/pione/command/pione-log-list-id.rb +48 -0
  58. data/lib/pione/command/pione-log.rb +19 -101
  59. data/lib/pione/command/pione-notification-listener.rb +95 -0
  60. data/lib/pione/command/pione-package-add.rb +137 -0
  61. data/lib/pione/command/pione-package-build.rb +122 -0
  62. data/lib/pione/command/pione-package-show.rb +96 -0
  63. data/lib/pione/command/pione-package-update.rb +59 -0
  64. data/lib/pione/command/pione-package.rb +11 -139
  65. data/lib/pione/command/pione-task-worker-broker.rb +88 -0
  66. data/lib/pione/command/pione-task-worker.rb +148 -98
  67. data/lib/pione/command/pione-tuple-space-provider.rb +62 -54
  68. data/lib/pione/command/pione-tuple-space-viewer.rb +105 -83
  69. data/lib/pione/command/pione-val.rb +39 -39
  70. data/lib/pione/command/spawner.rb +34 -27
  71. data/lib/pione/front.rb +4 -2
  72. data/lib/pione/front/basic-front.rb +86 -23
  73. data/lib/pione/front/client-front.rb +2 -2
  74. data/lib/pione/front/diagnosis-notification-front.rb +40 -0
  75. data/lib/pione/front/front-exception.rb +7 -1
  76. data/lib/pione/front/notification-listener-front.rb +36 -0
  77. data/lib/pione/front/notification-recipient-interface.rb +19 -0
  78. data/lib/pione/front/relay-front.rb +4 -4
  79. data/lib/pione/front/task-worker-broker-front.rb +19 -0
  80. data/lib/pione/front/task-worker-front.rb +2 -2
  81. data/lib/pione/front/tuple-space-provider-front.rb +3 -2
  82. data/lib/pione/global.rb +3 -1
  83. data/lib/pione/global/client-variable.rb +1 -1
  84. data/lib/pione/global/config.rb +63 -7
  85. data/lib/pione/global/diagnosis-variable.rb +26 -0
  86. data/lib/pione/global/item.rb +28 -5
  87. data/lib/pione/global/log-variable.rb +6 -5
  88. data/lib/pione/global/network-variable.rb +75 -4
  89. data/lib/pione/global/path-variable.rb +1 -1
  90. data/lib/pione/global/system-variable.rb +12 -12
  91. data/lib/pione/global/task-worker-broker-variable.rb +43 -0
  92. data/lib/pione/global/tuple-space-notifier-variable.rb +3 -55
  93. data/lib/pione/lang/boolean.rb +4 -0
  94. data/lib/pione/lang/data-expr.rb +1 -1
  95. data/lib/pione/lang/integer.rb +1 -1
  96. data/lib/pione/lang/string.rb +4 -0
  97. data/lib/pione/lang/type.rb +1 -1
  98. data/lib/pione/location.rb +1 -0
  99. data/lib/pione/location/data-location.rb +41 -13
  100. data/lib/pione/location/dropbox-location.rb +175 -56
  101. data/lib/pione/location/ftp-location.rb +4 -1
  102. data/lib/pione/location/http-location.rb +5 -3
  103. data/lib/pione/location/https-location.rb +4 -2
  104. data/lib/pione/location/local-location.rb +6 -3
  105. data/lib/pione/location/location-exception.rb +12 -0
  106. data/lib/pione/location/notification-scheme.rb +46 -0
  107. data/lib/pione/log.rb +8 -7
  108. data/lib/pione/log/debug.rb +9 -9
  109. data/lib/pione/log/domain-log.rb +6 -1
  110. data/lib/pione/log/message-log-receiver.rb +32 -0
  111. data/lib/pione/log/system-log.rb +62 -141
  112. data/lib/pione/model.rb +7 -0
  113. data/lib/pione/model/notification-listener-model.rb +29 -0
  114. data/lib/pione/model/task-worker-broker-model.rb +129 -0
  115. data/lib/pione/notification.rb +13 -0
  116. data/lib/pione/notification/address.rb +104 -0
  117. data/lib/pione/notification/exception.rb +10 -0
  118. data/lib/pione/notification/message.rb +109 -0
  119. data/lib/pione/notification/receiver.rb +90 -0
  120. data/lib/pione/notification/recipient.rb +68 -0
  121. data/lib/pione/notification/task-worker-broker-recipient.rb +85 -0
  122. data/lib/pione/notification/transmitter.rb +84 -0
  123. data/lib/pione/pnml.rb +35 -0
  124. data/lib/pione/pnml/annotation-extractor.rb +47 -0
  125. data/lib/pione/pnml/compiler.rb +176 -0
  126. data/lib/pione/pnml/input-merge-complement.rb +78 -0
  127. data/lib/pione/pnml/input-parallelization-complement.rb +75 -0
  128. data/lib/pione/pnml/input-reduction.rb +80 -0
  129. data/lib/pione/pnml/invalid-arc-elimination.rb +41 -0
  130. data/lib/pione/pnml/io-expansion.rb +88 -0
  131. data/lib/pione/pnml/isolated-element-elimination.rb +32 -0
  132. data/lib/pione/pnml/net-rewriter.rb +44 -0
  133. data/lib/pione/pnml/output-decomposition-complement.rb +77 -0
  134. data/lib/pione/pnml/output-reduction.rb +86 -0
  135. data/lib/pione/pnml/output-synchronization-complement.rb +77 -0
  136. data/lib/pione/pnml/pione-model.rb +417 -0
  137. data/lib/pione/pnml/pnml-exception.rb +23 -0
  138. data/lib/pione/pnml/pnml-model.rb +368 -0
  139. data/lib/pione/pnml/reader.rb +51 -0
  140. data/lib/pione/rule-engine/action-handler.rb +8 -6
  141. data/lib/pione/rule-engine/basic-handler.rb +5 -5
  142. data/lib/pione/rule-engine/engine-exception.rb +7 -6
  143. data/lib/pione/rule-engine/flow-handler.rb +27 -18
  144. data/lib/pione/system.rb +3 -1
  145. data/lib/pione/system/domain-dump.rb +34 -0
  146. data/lib/pione/system/file-cache.rb +92 -13
  147. data/lib/pione/system/init.rb +3 -0
  148. data/lib/pione/system/normalizer.rb +40 -0
  149. data/lib/pione/system/status.rb +5 -5
  150. data/lib/pione/system/system-exception.rb +14 -1
  151. data/lib/pione/task-worker-broker.rb +7 -0
  152. data/lib/pione/task-worker-broker/basic-provider.rb +20 -0
  153. data/lib/pione/task-worker-broker/easy-provider.rb +65 -0
  154. data/lib/pione/test-helper.rb +27 -0
  155. data/lib/pione/test-helper/command-helper.rb +9 -101
  156. data/lib/pione/tuple-space/basic-tuple.rb +1 -1
  157. data/lib/pione/tuple-space/tuple-definition.yml +4 -6
  158. data/lib/pione/tuple-space/tuple-space-interface.rb +3 -45
  159. data/lib/pione/tuple-space/tuple-space-server.rb +45 -0
  160. data/lib/pione/util.rb +1 -2
  161. data/lib/pione/util/boolean-value.rb +62 -0
  162. data/lib/pione/util/completion.rb +111 -0
  163. data/lib/pione/util/evaluatable.rb +13 -27
  164. data/lib/pione/util/package-parameters-list.rb +15 -27
  165. data/lib/pione/util/zip.rb +8 -3
  166. data/lib/pione/version.rb +1 -1
  167. data/lib/rootage.rb +20 -0
  168. data/lib/rootage/action.rb +114 -0
  169. data/lib/rootage/argument.rb +46 -0
  170. data/lib/rootage/command.rb +218 -0
  171. data/lib/rootage/core.rb +532 -0
  172. data/lib/rootage/exception.rb +107 -0
  173. data/lib/rootage/help.rb +148 -0
  174. data/lib/rootage/help.txt.erb +31 -0
  175. data/lib/rootage/log.rb +226 -0
  176. data/lib/rootage/normalizer.rb +184 -0
  177. data/lib/rootage/option.rb +152 -0
  178. data/lib/rootage/scenario-test-result.erb +39 -0
  179. data/lib/rootage/scenario.rb +362 -0
  180. data/lib/rootage/test-helper.rb +115 -0
  181. data/man/pione-list-param.1 +44 -0
  182. data/misc/clock.rb +9 -0
  183. data/misc/machine-info.sh +21 -0
  184. data/misc/pione-completion.bash +238 -0
  185. data/misc/pione-completion.erb +53 -0
  186. data/misc/pione-completion.zsh +238 -0
  187. data/misc/pione.god +22 -0
  188. data/misc/ui.xml +23 -0
  189. data/pione.gemspec +3 -1
  190. data/test/agent/spec_basic-agent.rb +1 -1
  191. data/test/agent/spec_input-generator.rb +2 -2
  192. data/test/agent/spec_messenger.rb +6 -9
  193. data/test/agent/spec_notification-listener.rb +80 -0
  194. data/test/agent/{spec_broker.rb → spec_task-worker-broker.rb} +13 -10
  195. data/test/agent/spec_tuple-space-provider.rb +10 -6
  196. data/test/command/command-behavior.rb +3 -11
  197. data/test/command/data/pione-list-param/AdvancedParameters.pione +12 -0
  198. data/test/command/data/pione-list-param/BasicParameters.pione +12 -0
  199. data/test/command/spec_pione-action-exec.rb +16 -0
  200. data/test/command/spec_pione-action-list.rb +15 -10
  201. data/test/command/spec_pione-action-print.rb +14 -0
  202. data/test/command/spec_pione-action.rb +6 -19
  203. data/test/command/spec_pione-clean.rb +29 -46
  204. data/test/command/spec_pione-client.rb +29 -36
  205. data/test/command/spec_pione-command.rb +6 -6
  206. data/test/command/{spec_pione-compiler.rb → spec_pione-compile.rb} +11 -13
  207. data/test/command/spec_pione-config-get.rb +47 -0
  208. data/test/command/spec_pione-config-list.rb +42 -0
  209. data/test/command/spec_pione-config-set.rb +38 -0
  210. data/test/command/spec_pione-config-unset.rb +44 -0
  211. data/test/command/spec_pione-config.rb +11 -0
  212. data/test/command/spec_pione-diagnosis-notification.rb +23 -0
  213. data/test/command/spec_pione-diagnosis.rb +11 -0
  214. data/test/command/spec_pione-lang-check-syntax.rb +12 -0
  215. data/test/command/spec_pione-lang.rb +11 -0
  216. data/test/command/spec_pione-log-format.rb +29 -0
  217. data/test/command/spec_pione-log-list-id.rb +17 -0
  218. data/test/command/spec_pione-log.rb +6 -20
  219. data/test/command/spec_pione-package-add.rb +55 -0
  220. data/test/command/spec_pione-package-build.rb +57 -0
  221. data/test/command/spec_pione-package-show.rb +72 -0
  222. data/test/command/{spec_pione-update-package-info.rb → spec_pione-package-update.rb} +12 -13
  223. data/test/command/spec_pione-package.rb +4 -104
  224. data/test/command/spec_pione-val.rb +10 -7
  225. data/test/global/spec_config.rb +50 -0
  226. data/test/global/spec_item.rb +1 -1
  227. data/test/literate-action/data/HelloWorld.md +1 -1
  228. data/test/location/location-behavior.rb +1 -1
  229. data/test/location/spec_dropbox-location.rb +39 -0
  230. data/test/location/spec_notification-scheme.rb +37 -0
  231. data/test/log/spec_debug.rb +5 -4
  232. data/test/log/spec_message-log-receiver.rb +13 -0
  233. data/test/log/spec_message-log.rb +6 -9
  234. data/test/log/spec_system-log.rb +5 -3
  235. data/test/notification/spec_address.rb +229 -0
  236. data/test/notification/spec_message.rb +30 -0
  237. data/test/notification/spec_receiver.rb +36 -0
  238. data/test/notification/spec_transmitter.rb +37 -0
  239. data/test/pnml/data/ConditionalBranchIf.pnml +270 -0
  240. data/test/pnml/data/ConditionalBranchIfElse.pnml +309 -0
  241. data/test/pnml/data/IOExpansionComplex.pnml +363 -0
  242. data/test/pnml/data/IOExpansionSimple.pnml +140 -0
  243. data/test/pnml/data/InputMergeComplementComplex.pnml +381 -0
  244. data/test/pnml/data/InputMergeComplementSimple.pnml +248 -0
  245. data/test/pnml/data/InputParallelizationComplementComplex.pnml +433 -0
  246. data/test/pnml/data/InputParallelizationComplementSimple.pnml +288 -0
  247. data/test/pnml/data/InputReductionComplex.pnml +192 -0
  248. data/test/pnml/data/InputReductionLong.pnml +344 -0
  249. data/test/pnml/data/InputReductionSimple.pnml +140 -0
  250. data/test/pnml/data/IsolatedElementElimination.pnml +171 -0
  251. data/test/pnml/data/OutputDecompositionComplementComplex.pnml +381 -0
  252. data/test/pnml/data/OutputDecompositionComplementSimple.pnml +242 -0
  253. data/test/pnml/data/OutputReductionComplex.pnml +186 -0
  254. data/test/pnml/data/OutputReductionLong.pnml +344 -0
  255. data/test/pnml/data/OutputReductionSimple.pnml +140 -0
  256. data/test/pnml/data/OutputSynchronizationComplementComplex.pnml +498 -0
  257. data/test/pnml/data/OutputSynchronizationComplementSimple.pnml +347 -0
  258. data/test/pnml/data/SampleNet.pnml +238 -0
  259. data/test/pnml/spec_input-merge-complement.rb +40 -0
  260. data/test/pnml/spec_input-parallelization-complement.rb +50 -0
  261. data/test/pnml/spec_input-reduction.rb +113 -0
  262. data/test/pnml/spec_invalid-arc-elimination.rb +33 -0
  263. data/test/pnml/spec_io-expansion.rb +126 -0
  264. data/test/pnml/spec_isolated-element-elimination.rb +25 -0
  265. data/test/pnml/spec_output-decomposition-complement.rb +40 -0
  266. data/test/pnml/spec_output-reduction.rb +114 -0
  267. data/test/pnml/spec_output-synchronization-complement.rb +62 -0
  268. data/test/pnml/spec_pione-element.rb +144 -0
  269. data/test/pnml/spec_pnml-element.rb +373 -0
  270. data/test/pnml/spec_reader.rb +16 -0
  271. data/test/rootage/spec_argument.rb +18 -0
  272. data/test/rootage/spec_command.rb +239 -0
  273. data/test/rootage/spec_core.rb +198 -0
  274. data/test/rootage/spec_scenario.rb +149 -0
  275. data/test/system/{spec_domain-info.rb → spec_domain-dump.rb} +6 -6
  276. data/test/system/spec_file-cache.rb +6 -9
  277. data/test/tuple-space/spec_finished-tuple.rb +1 -1
  278. data/test/util/{spec_package-parameters-list_1.pione → data/package-parameters-list/Param1.pione} +0 -0
  279. data/test/util/{spec_package-parameters-list_2.pione → data/package-parameters-list/Param2.pione} +0 -0
  280. data/test/util/{spec_package-parameters-list_3.pione → data/package-parameters-list/Param3.pione} +0 -0
  281. data/test/util/{spec_package-parameters-list_4.pione → data/package-parameters-list/Param4.pione} +0 -0
  282. data/test/util/spec_boolean-value.rb +32 -0
  283. data/test/util/spec_completion.rb +22 -0
  284. data/test/util/spec_package-parameters-list.rb +39 -52
  285. data/test/util/spec_zip.rb +28 -1
  286. metadata +288 -47
  287. data/bin/pione-tuple-space-receiver +0 -5
  288. data/lib/pione/agent/broker.rb +0 -304
  289. data/lib/pione/agent/tuple-space-receiver.rb +0 -137
  290. data/lib/pione/command/pione-broker.rb +0 -104
  291. data/lib/pione/command/pione-compiler.rb +0 -57
  292. data/lib/pione/command/pione-relay-account-db.rb +0 -141
  293. data/lib/pione/command/pione-relay-client-db.rb +0 -118
  294. data/lib/pione/command/pione-relay.rb +0 -59
  295. data/lib/pione/command/pione-syntax-checker.rb +0 -214
  296. data/lib/pione/command/pione-tuple-space-receiver.rb +0 -111
  297. data/lib/pione/command/pione-update-package-info.rb +0 -53
  298. data/lib/pione/front/broker-front.rb +0 -22
  299. data/lib/pione/front/tuple-space-receiver-front.rb +0 -11
  300. data/lib/pione/global/broker-variable.rb +0 -33
  301. data/lib/pione/system/domain-info.rb +0 -25
  302. data/lib/pione/util/pnml-compiler.rb +0 -168
  303. data/test/agent/spec_tuple-space-receiver.rb +0 -47
  304. data/test/util/spec_pnml-compiler.rb +0 -32
@@ -3,23 +3,27 @@ require 'pione/test-helper'
3
3
  describe 'Pione::Agent::TupleSpaceProvider' do
4
4
  before do
5
5
  @tuple_space = TestHelper::TupleSpace.create(self)
6
- @front = Front::TupleSpaceProviderFront.new(@tuple_space)
7
- @orig = Global.presence_notification_addresses
6
+ @cmd = Command::BasicCommand.new([])
7
+ @cmd.model[:parent_front] = Front::ClientFront.new(@cmd)
8
+ @cmd.model[:parent_front].set_tuple_space(@tuple_space)
9
+ @front = Front::TupleSpaceProviderFront.new(@cmd)
10
+ @orig = Global.notification_targets
8
11
  end
9
12
 
10
13
  after do
14
+ @cmd.model[:parent_front].terminate
11
15
  @front.terminate
12
- Global.presence_notification_addresses = @orig
16
+ Global.notification_targets = @orig
13
17
  end
14
18
 
15
19
  it 'should start activity' do
16
- provider = Agent::TupleSpaceProvider.start(@front)
17
- provider.wait_until_after(:send_packet, 10)
20
+ provider = Agent::TupleSpaceProvider.start(@front, [URI.parse("pnu://127.0.0.1:3456")])
21
+ provider.wait_until_after(:send_message, 10)
18
22
  provider.should.not.terminated
19
23
  end
20
24
 
21
25
  it 'should terminate' do
22
- provider = Agent::TupleSpaceProvider.start(@front)
26
+ provider = Agent::TupleSpaceProvider.start(@front, [URI.parse("pnu://127.0.0.1:3456")])
23
27
  should.not.raise { provider.terminate }
24
28
  provider.should.terminated
25
29
  end
@@ -1,15 +1,7 @@
1
1
  shared "command" do
2
2
  it "should show a help message" do
3
- res = TestHelper::Command.succeed do
4
- Command::PioneVal.run ["--help"]
5
- end
6
- res.stdout.string.should.start_with "Usage"
7
- end
8
-
9
- it "should show a version message" do
10
- res = TestHelper::Command.succeed do
11
- Command::PioneVal.run ["--version"]
12
- end
13
- res.stdout.string.should.include Pione::VERSION
3
+ cmd = @cmd.new(["--help"])
4
+ res = Rootage::ScenarioTest.succeed(cmd)
5
+ res.stdout.string.size.should > 0
14
6
  end
15
7
  end
@@ -0,0 +1,12 @@
1
+ param $B1 := true
2
+ advanced param $B2 := false
3
+ advanced param $B3 := true | false
4
+
5
+ param $I1 := 1
6
+ advanced param $I2 := 1 | 2 | 3
7
+
8
+ param $S1 := "test"
9
+ advanced param $S2 := "test1" | "test2" | "test3"
10
+
11
+ param $D1 := 'test.txt'
12
+ advanced param $D2 := 'test1.txt' | 'test2.txt' | 'test3.txt'
@@ -0,0 +1,12 @@
1
+ param $B1 := true
2
+ param $B2 := false
3
+ param $B3 := true | false
4
+
5
+ param $I1 := 1
6
+ param $I2 := 1 | 2 | 3
7
+
8
+ param $S1 := "test"
9
+ param $S2 := "test1" | "test2" | "test3"
10
+
11
+ param $D1 := 'test.txt'
12
+ param $D2 := 'test1.txt' | 'test2.txt' | 'test3.txt'
@@ -0,0 +1,16 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe Pione::Command::PioneActionExec do
4
+ before do
5
+ @cmd = Pione::Command::PioneActionExec
6
+ @dir = Location[File.dirname(__FILE__)] + ".." + "literate-action" + "data"
7
+ end
8
+
9
+ it "should execute action" do
10
+ base = Location[Temppath.mkdir]
11
+ args = [(@dir + "HelloWorld.md").path.to_s, "SayHello", "-d", base.path.to_s]
12
+ cmd = @cmd.new(args)
13
+ Rootage::ScenarioTest.succeed(cmd)
14
+ (base + "message.txt").read.chomp.should == "Hello, world!"
15
+ end
16
+ end
@@ -1,15 +1,20 @@
1
1
  require 'pione/test-helper'
2
2
 
3
- TestHelper.scope do |this|
4
- this::DIR = Location[File.dirname(__FILE__)] + ".." + "literate-action" + "data"
3
+ describe Pione::Command::PioneActionList do
4
+ before do
5
+ @cmd = Pione::Command::PioneActionList
6
+ @dir = Location[File.dirname(__FILE__)] + ".." + "literate-action" + "data"
7
+ end
8
+
9
+ it "should show action names" do
10
+ cmd = @cmd.new([(@dir + "D1.md").path.to_s])
11
+ res = Rootage::ScenarioTest.succeed(cmd)
12
+ res.stdout.string.chomp.should == "Name1\nName2"
13
+ end
5
14
 
6
- describe Pione::Command::PioneActionList do
7
- it "should show action names" do
8
- args = [(this::DIR + "D1.md").path.to_s]
9
- res = TestHelper::Command.succeed do
10
- Pione::Command::PioneActionList.run(args)
11
- end
12
- res.stdout.string.chomp.should == "Name1\nName2"
13
- end
15
+ it "should show action names in compact form" do
16
+ cmd = @cmd.new(["--compact", (@dir + "D1.md").path.to_s])
17
+ res = Rootage::ScenarioTest.succeed(cmd)
18
+ res.stdout.string.chomp.should == "Name1 Name2"
14
19
  end
15
20
  end
@@ -0,0 +1,14 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe Pione::Command::PioneActionPrint do
4
+ before do
5
+ @cmd = Pione::Command::PioneActionPrint
6
+ @dir = Location[File.dirname(__FILE__)] + ".." + "literate-action" + "data"
7
+ end
8
+
9
+ it "should print action contents" do
10
+ cmd = @cmd.new([(@dir + "HelloWorld.md").path.to_s, "SayHello"])
11
+ res = Rootage::ScenarioTest.succeed(cmd)
12
+ res.stdout.string.chomp.should == "echo \"Hello, world!\" > message.txt"
13
+ end
14
+ end
@@ -1,24 +1,11 @@
1
1
  require 'pione/test-helper'
2
2
 
3
- TestHelper.scope do |this|
4
- this::DIR = Location[File.dirname(__FILE__)] + ".." + "literate-action" + "data"
5
-
6
- describe Pione::Command::PioneAction do
7
- it "should execute action" do
8
- base = Location[Temppath.mkdir]
9
- args = [(this::DIR + "HelloWorld.md").path.to_s, "SayHello", "-d", base.path.to_s]
10
- TestHelper::Command.succeed do
11
- Pione::Command::PioneAction.run(args)
12
- end
13
- (base + "message.txt").read.chomp.should == "Hello, world!"
14
- end
3
+ describe Pione::Command::PioneAction do
4
+ before do
5
+ @cmd = Pione::Command::PioneAction
6
+ end
15
7
 
16
- it "should show action content" do
17
- args = [(this::DIR + "HelloWorld.md").path.to_s, "SayHello", "--show"]
18
- res = TestHelper::Command.succeed do
19
- Pione::Command::PioneAction.run(args)
20
- end
21
- res.stdout.string.chomp.should == "echo \"Hello, world!\" > message.txt"
22
- end
8
+ it "should fail with no subcommands" do
9
+ Rootage::ScenarioTest.fail(@cmd.new([]))
23
10
  end
24
11
  end
@@ -83,10 +83,9 @@ TestHelper.scope do |this|
83
83
  end
84
84
  end
85
85
 
86
- describe "Pione::Command::PioneClean" do
87
- behaves_like "command"
88
-
86
+ describe Pione::Command::PioneClean do
89
87
  before do
88
+ @cmd = Pione::Command::PioneClean
90
89
  @orig_my_temporary_directory = Global.my_temporary_directory
91
90
  Global.my_temporary_directory = Temppath.mkdir
92
91
  @orig_file_cache_directory = Global.my_file_cache_directory
@@ -107,103 +106,87 @@ TestHelper.scope do |this|
107
106
  Global.profile_report_directory = @orig_profile_report_directory
108
107
  end
109
108
 
109
+ behaves_like "command"
110
+
110
111
  it "should remove all type files" do
111
112
  fset = this::FakeFileSet.new
112
- TestHelper::Command.succeed do
113
- Command::PioneClean.run([])
114
- end
113
+ Rootage::ScenarioTest.succeed(@cmd.new([]))
115
114
  fset.temporary.size.should == 0
116
115
  fset.file_cache.size.should == 0
117
116
  fset.package_cache.size.should == 0
118
117
  fset.profile.size.should == 0
119
118
  end
120
119
 
121
- it "should remove old than 1 days" do
120
+ it "should remove older files than 1 days" do
122
121
  fset = this::FakeFileSet.new
123
- TestHelper::Command.succeed do
124
- Command::PioneClean.run ["--older", "1"]
125
- end
122
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", "1"]))
126
123
  fset.temporary.size.should == 0
127
124
  fset.file_cache.size.should == 0
128
125
  fset.package_cache.size.should == 0
129
126
  fset.profile.size.should == 0
130
127
  end
131
128
 
132
- it "should remove old than 2 days" do
129
+ it "should remove older files than 2 days" do
133
130
  fset = this::FakeFileSet.new
134
- TestHelper::Command.succeed do
135
- Command::PioneClean.run ["--older", "2"]
136
- end
131
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", "2"]))
137
132
  fset.temporary.size.should == 4
138
133
  fset.file_cache.size.should == 2
139
134
  fset.package_cache.size.should == 2
140
135
  fset.profile.size.should == 1
141
136
  end
142
137
 
143
- it "should remove old than 30 days" do
138
+ it "should remove older files than 30 days" do
144
139
  fset = this::FakeFileSet.new
145
- TestHelper::Command.succeed do
146
- Command::PioneClean.run ["--older", "30"]
147
- end
140
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", "30"]))
148
141
  fset.temporary.size.should == 4
149
142
  fset.file_cache.size.should == 2
150
143
  fset.package_cache.size.should == 2
151
144
  fset.profile.size.should == 1
152
145
  end
153
146
 
154
- it "should remove old than 31 days" do
147
+ it "should remove older files than 31 days" do
155
148
  fset = this::FakeFileSet.new
156
- TestHelper::Command.succeed do
157
- Command::PioneClean.run ["--older", "31"]
158
- end
149
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", "31"]))
159
150
  fset.temporary.size.should == 8
160
151
  fset.file_cache.size.should == 4
161
152
  fset.package_cache.size.should == 4
162
153
  fset.profile.size.should == 2
163
154
  end
164
155
 
165
- it "should remove older than 1 days with iso8601 format" do
156
+ it "should remove older files than 1 days with iso8601 format" do
166
157
  fset = this::FakeFileSet.new
167
158
  date = this.days_before(1)
168
- TestHelper::Command.succeed do
169
- Command::PioneClean.run ["--older", date.iso8601]
170
- end
159
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", date.iso8601]))
171
160
  fset.temporary.size.should == 0
172
161
  fset.file_cache.size.should == 0
173
162
  fset.package_cache.size.should == 0
174
163
  fset.profile.size.should == 0
175
164
  end
176
165
 
177
- it "should remove older than 2 days with iso8601 format" do
166
+ it "should remove older files than 2 days with iso8601 format" do
178
167
  fset = this::FakeFileSet.new
179
168
  date = this.days_before(2)
180
- TestHelper::Command.succeed do
181
- Command::PioneClean.run ["--older", date.iso8601]
182
- end
169
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", date.iso8601]))
183
170
  fset.temporary.size.should == 4
184
171
  fset.file_cache.size.should == 2
185
172
  fset.package_cache.size.should == 2
186
173
  fset.profile.size.should == 1
187
174
  end
188
175
 
189
- it "should remove older than 30 days with iso8601 format" do
176
+ it "should remove older files than 30 days with iso8601 format" do
190
177
  fset = this::FakeFileSet.new
191
178
  date = this.days_before(30)
192
- TestHelper::Command.succeed do
193
- Command::PioneClean.run ["--older", date.iso8601]
194
- end
179
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", date.iso8601]))
195
180
  fset.temporary.size.should == 4
196
181
  fset.file_cache.size.should == 2
197
182
  fset.package_cache.size.should == 2
198
183
  fset.profile.size.should == 1
199
184
  end
200
185
 
201
- it "should remove older than 31 days with iso8601 format" do
186
+ it "should remove older files than 31 days with iso8601 format" do
202
187
  fset = this::FakeFileSet.new
203
188
  date = this.days_before(31)
204
- TestHelper::Command.succeed do
205
- Command::PioneClean.run ["--older", date.iso8601]
206
- end
189
+ Rootage::ScenarioTest.succeed(@cmd.new(["--older", date.iso8601]))
207
190
  fset.temporary.size.should == 8
208
191
  fset.file_cache.size.should == 4
209
192
  fset.package_cache.size.should == 4
@@ -211,9 +194,9 @@ TestHelper.scope do |this|
211
194
  end
212
195
 
213
196
  it "should remove temporary files" do
214
- TestHelper::Command.succeed do
197
+ Rootage::ScenarioTest.succeed(@cmd, ["--type", "temporary"]) do |cmd, args|
215
198
  fset = this::FakeFileSet.new
216
- Command::PioneClean.run ["--type", "temporary"]
199
+ cmd.run(args)
217
200
  fset.temporary.size.should == 0
218
201
  fset.file_cache.size.should == 4
219
202
  fset.package_cache.size.should == 4
@@ -222,9 +205,9 @@ TestHelper.scope do |this|
222
205
  end
223
206
 
224
207
  it "should remove file cache files" do
225
- TestHelper::Command.succeed do
208
+ Rootage::ScenarioTest.succeed(@cmd, ["--type", "file-cache"]) do |cmd, args|
226
209
  fset = this::FakeFileSet.new
227
- Command::PioneClean.run ["--type", "file-cache"]
210
+ cmd.run(args)
228
211
  fset.temporary.size.should == 8
229
212
  fset.file_cache.size.should == 0
230
213
  fset.package_cache.size.should == 4
@@ -233,9 +216,9 @@ TestHelper.scope do |this|
233
216
  end
234
217
 
235
218
  it "should remove package cache files" do
236
- TestHelper::Command.succeed do
219
+ Rootage::ScenarioTest.succeed(@cmd, ["--type", "package-cache"]) do |cmd, args|
237
220
  fset = this::FakeFileSet.new
238
- Command::PioneClean.run ["--type", "package-cache"]
221
+ cmd.run(args)
239
222
  fset.temporary.size.should == 8
240
223
  fset.file_cache.size.should == 4
241
224
  fset.package_cache.size.should == 0
@@ -244,9 +227,9 @@ TestHelper.scope do |this|
244
227
  end
245
228
 
246
229
  it "should remove profile files" do
247
- TestHelper::Command.succeed do
230
+ Rootage::ScenarioTest.succeed(@cmd, ["--type", "profile"]) do |cmd, args|
248
231
  fset = this::FakeFileSet.new
249
- Command::PioneClean.run ["--type", "profile"]
232
+ cmd.run(args)
250
233
  fset.temporary.size.should == 8
251
234
  fset.file_cache.size.should == 4
252
235
  fset.package_cache.size.should == 4
@@ -4,45 +4,41 @@ require_relative 'command-behavior'
4
4
  TestHelper.scope do |this|
5
5
  this::DIR = Location[File.dirname(__FILE__)] + "data" + "pione-client"
6
6
 
7
- describe "Pione::Command::PioneClient" do
7
+ describe Pione::Command::PioneClient do
8
+ before do
9
+ @cmd = Command::PioneClient
10
+ end
11
+
8
12
  behaves_like "command"
9
13
 
10
14
  it "should execute a PIONE document" do
11
15
  path = Temppath.create
12
- args = ["example/HelloWorld/HelloWorld.pione", "-o", path.to_s]
13
- res = TestHelper::Command.succeed do
14
- Pione::Command::PioneClient.run(args)
15
- end
16
+ cmd = @cmd.new(["example/HelloWorld/HelloWorld.pione", "-o", path.to_s])
17
+ res = Rootage::ScenarioTest.succeed(cmd)
16
18
  Location[path + "message.txt"].should.exist
17
19
  Location[path + "message.txt"].read.should.start_with "Hello, world!"
18
20
  end
19
21
 
20
22
  it "should execute a PIONE document with stand alone mode" do
21
23
  path = Temppath.create
22
- args = ["example/HelloWorld/HelloWorld.pione", "-o", path.to_s, "--stand-alone"]
23
- TestHelper::Command.succeed do
24
- Pione::Command::PioneClient.run(args)
25
- end
24
+ cmd = @cmd.new(["example/HelloWorld/HelloWorld.pione", "-o", path.to_s, "--stand-alone"])
25
+ Rootage::ScenarioTest.succeed(cmd)
26
26
  Location[path + "message.txt"].should.exist
27
27
  Location[path + "message.txt"].read.should.start_with "Hello, world!"
28
28
  end
29
29
 
30
30
  it "should execute a PIONE package" do
31
31
  path = Temppath.create
32
- args = ["example/HelloWorld/", "-o", path.to_s]
33
- TestHelper::Command.succeed do
34
- Pione::Command::PioneClient.run(args)
35
- end
32
+ cmd = @cmd.new(["example/HelloWorld/", "-o", path.to_s])
33
+ Rootage::ScenarioTest.succeed(cmd)
36
34
  Location[path + "message.txt"].should.exist
37
35
  Location[path + "message.txt"].read.should.start_with "Hello, world!"
38
36
  end
39
37
 
40
38
  it "should execute a PIONE package with stand alone mode" do
41
39
  path = Temppath.create
42
- args = ["example/HelloWorld/", "-o", path.to_s, "--stand-alone"]
43
- TestHelper::Command.succeed do
44
- Pione::Command::PioneClient.run(args)
45
- end
40
+ cmd = @cmd.new(["example/HelloWorld/", "-o", path.to_s, "--stand-alone"])
41
+ Rootage::ScenarioTest.succeed(cmd)
46
42
  Location[path + "message.txt"].should.exist
47
43
  Location[path + "message.txt"].read.should.start_with "Hello, world!"
48
44
  end
@@ -50,18 +46,8 @@ TestHelper.scope do |this|
50
46
  it "should fail with action error" do
51
47
  doc = (this::DIR + "ActionError.pione").path.to_s
52
48
  path = Temppath.create
53
- args = [doc, "-o", path.to_s, "--stand-alone"]
54
- TestHelper::Command.fail do
55
- Pione::Command::PioneClient.run(args)
56
- end
57
- end
58
-
59
- it "should show parameters list of package" do
60
- args = ["example/HelloWorld/HelloWorld.pione", "--list-params"]
61
- res = TestHelper::Command.succeed do
62
- Pione::Command::PioneClient.run(args)
63
- end
64
- res.stdout.string.size.should > 0
49
+ cmd = @cmd.new([doc, "-o", path.to_s, "--stand-alone"])
50
+ Rootage::ScenarioTest.fail(cmd)
65
51
  end
66
52
 
67
53
  describe "example/Fib" do
@@ -166,13 +152,13 @@ TestHelper.scope do |this|
166
152
  (base + "2.b").should.exist
167
153
  (base + "3.b").should.exist
168
154
  (base + "4.b").should.exist
169
- (base + "1.a").mtime.should < (base + "2.a").mtime
170
- (base + "2.a").mtime.should < (base + "3.a").mtime
171
- (base + "3.a").mtime.should < (base + "4.a").mtime
172
- (base + "4.a").mtime.should < (base + "1.b").mtime
173
- (base + "1.b").mtime.should < (base + "2.b").mtime
174
- (base + "2.b").mtime.should < (base + "3.b").mtime
175
- (base + "3.b").mtime.should < (base + "4.b").mtime
155
+ (base + "1.a").mtime.should <= (base + "2.a").mtime
156
+ (base + "2.a").mtime.should <= (base + "3.a").mtime
157
+ (base + "3.a").mtime.should <= (base + "4.a").mtime
158
+ (base + "4.a").mtime.should <= (base + "1.b").mtime
159
+ (base + "1.b").mtime.should <= (base + "2.b").mtime
160
+ (base + "2.b").mtime.should <= (base + "3.b").mtime
161
+ (base + "3.b").mtime.should <= (base + "4.b").mtime
176
162
  end
177
163
  end
178
164
  end
@@ -252,5 +238,12 @@ TestHelper.scope do |this|
252
238
  end
253
239
  end
254
240
 
241
+ describe "example/ActionError" do
242
+ TestHelper::PioneClientRunner.test(self) do |runner|
243
+ runner.title = "should fail in execution of example/ActionError"
244
+ runner.args = ["example/ActionError", *runner.default_arguments]
245
+ runner.fail
246
+ end
247
+ end
255
248
  end
256
249
  end