pione 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. data/.gitignore +16 -13
  2. data/.travis.yml +1 -1
  3. data/History.txt +11 -0
  4. data/Rakefile +13 -0
  5. data/bin/pione-package +5 -0
  6. data/example/AbstractRule/package.yml +6 -0
  7. data/example/AbstractRule/scenario/a/output/message.txt +1 -0
  8. data/example/AbstractRule/scenario/a/scenario.yml +4 -0
  9. data/example/AbstractRule/scenario/b/output/message.txt +1 -0
  10. data/example/AbstractRule/scenario/b/scenario.yml +4 -0
  11. data/example/AbstractRule/scenario/c/output/message.txt +1 -0
  12. data/example/AbstractRule/scenario/c/scenario.yml +4 -0
  13. data/example/HelloWorld/package.yml +5 -1
  14. data/example/HelloWorld/scenario/scenario.yml +2 -1
  15. data/example/LoopByTouch/package.yml +4 -1
  16. data/example/MakePair/package.yml +6 -0
  17. data/example/MakePair/scenario/{input → case1/input}/1.i +0 -0
  18. data/example/MakePair/scenario/{input → case1/input}/2.i +0 -0
  19. data/example/MakePair/scenario/{input → case1/input}/3.i +0 -0
  20. data/example/MakePair/scenario/{input → case1/input}/4.i +0 -0
  21. data/example/MakePair/scenario/{input → case1/input}/5.i +0 -0
  22. data/example/MakePair/scenario/{output → case1/output}/comb-1-2.pair +0 -0
  23. data/example/MakePair/scenario/{output → case1/output}/comb-1-3.pair +0 -0
  24. data/example/MakePair/scenario/{output → case1/output}/comb-1-4.pair +0 -0
  25. data/example/MakePair/scenario/{output → case1/output}/comb-1-5.pair +0 -0
  26. data/example/MakePair/scenario/{output → case1/output}/comb-2-3.pair +0 -0
  27. data/example/MakePair/scenario/{output → case1/output}/comb-2-4.pair +0 -0
  28. data/example/MakePair/scenario/{output → case1/output}/comb-2-5.pair +0 -0
  29. data/example/MakePair/scenario/{output → case1/output}/comb-3-4.pair +0 -0
  30. data/example/MakePair/scenario/{output → case1/output}/comb-3-5.pair +0 -0
  31. data/example/MakePair/scenario/{output → case1/output}/comb-4-5.pair +0 -0
  32. data/example/MakePair/scenario/{output → case1/output}/perm-1-2.pair +0 -0
  33. data/example/MakePair/scenario/{output → case1/output}/perm-1-3.pair +0 -0
  34. data/example/MakePair/scenario/{output → case1/output}/perm-1-4.pair +0 -0
  35. data/example/MakePair/scenario/{output → case1/output}/perm-1-5.pair +0 -0
  36. data/example/MakePair/scenario/{output → case1/output}/perm-2-1.pair +0 -0
  37. data/example/MakePair/scenario/{output → case1/output}/perm-2-3.pair +0 -0
  38. data/example/MakePair/scenario/{output → case1/output}/perm-2-4.pair +0 -0
  39. data/example/MakePair/scenario/{output → case1/output}/perm-2-5.pair +0 -0
  40. data/example/MakePair/scenario/{output → case1/output}/perm-3-1.pair +0 -0
  41. data/example/MakePair/scenario/{output → case1/output}/perm-3-2.pair +0 -0
  42. data/example/MakePair/scenario/{output → case1/output}/perm-3-4.pair +0 -0
  43. data/example/MakePair/scenario/{output → case1/output}/perm-3-5.pair +0 -0
  44. data/example/MakePair/scenario/{output → case1/output}/perm-4-1.pair +0 -0
  45. data/example/MakePair/scenario/{output → case1/output}/perm-4-2.pair +0 -0
  46. data/example/MakePair/scenario/{output → case1/output}/perm-4-3.pair +0 -0
  47. data/example/MakePair/scenario/{output → case1/output}/perm-4-5.pair +0 -0
  48. data/example/MakePair/scenario/{output → case1/output}/perm-5-1.pair +0 -0
  49. data/example/MakePair/scenario/{output → case1/output}/perm-5-2.pair +0 -0
  50. data/example/MakePair/scenario/{output → case1/output}/perm-5-3.pair +0 -0
  51. data/example/MakePair/scenario/{output → case1/output}/perm-5-4.pair +0 -0
  52. data/example/MakePair/scenario/{output → case1/output}/succ-1-2.pair +0 -0
  53. data/example/MakePair/scenario/{output → case1/output}/succ-2-3.pair +0 -0
  54. data/example/MakePair/scenario/{output → case1/output}/succ-3-4.pair +0 -0
  55. data/example/MakePair/scenario/{output → case1/output}/succ-4-5.pair +0 -0
  56. data/example/MakePair/scenario/case1/scenario.yml +42 -0
  57. data/example/MakePair/scenario/case2/input/10.i +0 -0
  58. data/example/MakePair/scenario/case2/input/11.i +0 -0
  59. data/example/MakePair/scenario/case2/input/9.i +0 -0
  60. data/example/MakePair/scenario/case2/output/comb-10-11.pair +0 -0
  61. data/example/MakePair/scenario/case2/output/comb-9-10.pair +0 -0
  62. data/example/MakePair/scenario/case2/output/comb-9-11.pair +0 -0
  63. data/example/MakePair/scenario/case2/output/perm-10-11.pair +0 -0
  64. data/example/MakePair/scenario/case2/output/perm-10-9.pair +0 -0
  65. data/example/MakePair/scenario/case2/output/perm-11-10.pair +0 -0
  66. data/example/MakePair/scenario/case2/output/perm-11-9.pair +0 -0
  67. data/example/MakePair/scenario/case2/output/perm-9-10.pair +0 -0
  68. data/example/MakePair/scenario/case2/output/perm-9-11.pair +0 -0
  69. data/example/MakePair/scenario/case2/output/succ-10-11.pair +0 -0
  70. data/example/MakePair/scenario/case2/output/succ-9-10.pair +0 -0
  71. data/example/MakePair/scenario/case2/scenario.yml +17 -0
  72. data/example/MakePair/scenario/case3/input/1.i +0 -0
  73. data/example/MakePair/scenario/case3/input/3.i +0 -0
  74. data/example/MakePair/scenario/case3/input/5.i +0 -0
  75. data/example/MakePair/scenario/case3/input/7.i +0 -0
  76. data/example/MakePair/scenario/case3/input/9.i +0 -0
  77. data/example/MakePair/scenario/case3/output/comb-1-3.pair +0 -0
  78. data/example/MakePair/scenario/case3/output/comb-1-5.pair +0 -0
  79. data/example/MakePair/scenario/case3/output/comb-1-7.pair +0 -0
  80. data/example/MakePair/scenario/case3/output/comb-1-9.pair +0 -0
  81. data/example/MakePair/scenario/case3/output/comb-3-5.pair +0 -0
  82. data/example/MakePair/scenario/case3/output/comb-3-7.pair +0 -0
  83. data/example/MakePair/scenario/case3/output/comb-3-9.pair +0 -0
  84. data/example/MakePair/scenario/case3/output/comb-5-7.pair +0 -0
  85. data/example/MakePair/scenario/case3/output/comb-5-9.pair +0 -0
  86. data/example/MakePair/scenario/case3/output/comb-7-9.pair +0 -0
  87. data/example/MakePair/scenario/case3/output/perm-1-3.pair +0 -0
  88. data/example/MakePair/scenario/case3/output/perm-1-5.pair +0 -0
  89. data/example/MakePair/scenario/case3/output/perm-1-7.pair +0 -0
  90. data/example/MakePair/scenario/case3/output/perm-1-9.pair +0 -0
  91. data/example/MakePair/scenario/case3/output/perm-3-1.pair +0 -0
  92. data/example/MakePair/scenario/case3/output/perm-3-5.pair +0 -0
  93. data/example/MakePair/scenario/case3/output/perm-3-7.pair +0 -0
  94. data/example/MakePair/scenario/case3/output/perm-3-9.pair +0 -0
  95. data/example/MakePair/scenario/case3/output/perm-5-1.pair +0 -0
  96. data/example/MakePair/scenario/case3/output/perm-5-3.pair +0 -0
  97. data/example/MakePair/scenario/case3/output/perm-5-7.pair +0 -0
  98. data/example/MakePair/scenario/case3/output/perm-5-9.pair +0 -0
  99. data/example/MakePair/scenario/case3/output/perm-7-1.pair +0 -0
  100. data/example/MakePair/scenario/case3/output/perm-7-3.pair +0 -0
  101. data/example/MakePair/scenario/case3/output/perm-7-5.pair +0 -0
  102. data/example/MakePair/scenario/case3/output/perm-7-9.pair +0 -0
  103. data/example/MakePair/scenario/case3/output/perm-9-1.pair +0 -0
  104. data/example/MakePair/scenario/case3/output/perm-9-3.pair +0 -0
  105. data/example/MakePair/scenario/case3/output/perm-9-5.pair +0 -0
  106. data/example/MakePair/scenario/case3/output/perm-9-7.pair +0 -0
  107. data/example/MakePair/scenario/case3/scenario.yml +39 -0
  108. data/example/PegasusWMS/Merge/Merge.pione +21 -0
  109. data/example/PegasusWMS/Merge/package.yml +2 -0
  110. data/example/PegasusWMS/Pipeline/Pipeline.pione +20 -0
  111. data/example/PegasusWMS/Pipeline/package.yml +2 -0
  112. data/example/PegasusWMS/Split/Split.pione +27 -0
  113. data/example/PegasusWMS/Split/package.yml +2 -0
  114. data/example/ScoreAggregation/package.yml +4 -0
  115. data/example/ScoreAggregation/scenario/case1/scenario.yml +27 -1
  116. data/example/SerialProcessing/package.yml +5 -1
  117. data/example/SerialProcessing/scenario/scenario.yml +10 -0
  118. data/lib/pione.rb +20 -71
  119. data/lib/pione/agent.rb +17 -0
  120. data/lib/pione/agent/basic-agent.rb +2 -4
  121. data/lib/pione/command.rb +1 -0
  122. data/lib/pione/command/option.rb +4 -1
  123. data/lib/pione/command/pione-package.rb +97 -0
  124. data/lib/pione/command/pione-task-worker.rb +11 -7
  125. data/lib/pione/component.rb +5 -0
  126. data/lib/pione/component/document.rb +22 -5
  127. data/lib/pione/component/package-archiver.rb +92 -0
  128. data/lib/pione/component/package-expander.rb +37 -0
  129. data/lib/pione/component/package-filename.rb +38 -0
  130. data/lib/pione/component/package-reader.rb +276 -0
  131. data/lib/pione/component/package.rb +50 -162
  132. data/lib/pione/front.rb +14 -0
  133. data/lib/pione/location.rb +5 -0
  134. data/lib/pione/location/basic-location.rb +47 -274
  135. data/lib/pione/location/data-location.rb +328 -0
  136. data/lib/pione/location/dropbox-location.rb +30 -7
  137. data/lib/pione/location/exception.rb +38 -0
  138. data/lib/pione/location/ftp-location.rb +24 -13
  139. data/lib/pione/location/git-repository-location.rb +153 -0
  140. data/lib/pione/location/http-location.rb +65 -0
  141. data/lib/pione/location/https-location.rb +37 -0
  142. data/lib/pione/location/local-location.rb +24 -5
  143. data/lib/pione/parser.rb +14 -0
  144. data/lib/pione/patch.rb +10 -0
  145. data/lib/pione/patch/drb-patch.rb +2 -2
  146. data/lib/pione/relay.rb +11 -0
  147. data/lib/pione/system/file-cache.rb +1 -1
  148. data/lib/pione/system/global.rb +15 -0
  149. data/lib/pione/tuple-space.rb +11 -0
  150. data/lib/pione/tuple-space/tuple-space-server.rb +1 -1
  151. data/lib/pione/util.rb +1 -0
  152. data/lib/pione/util/error-report.rb +7 -0
  153. data/lib/pione/util/misc.rb +2 -2
  154. data/lib/pione/util/zip.rb +60 -0
  155. data/lib/pione/version.rb +1 -1
  156. data/pione.gemspec +5 -1
  157. data/test/agent/spec_rule-provider.rb +2 -2
  158. data/test/command/spec_pione-package.rb +15 -0
  159. data/test/component/spec_document.rb +2 -2
  160. data/test/component/spec_package-archiver.rb +27 -0
  161. data/test/component/spec_package-expander.rb +11 -0
  162. data/test/component/spec_package-filename.rb +79 -0
  163. data/test/component/spec_package-reader.rb +100 -0
  164. data/test/component/spec_package.rb +50 -33
  165. data/test/location/http-behavior.rb +59 -0
  166. data/test/location/location-behavior.rb +8 -0
  167. data/test/location/spec_basic-location.rb +5 -1
  168. data/test/location/spec_git-repository-location.rb +143 -0
  169. data/test/location/spec_http-location.rb +28 -0
  170. data/test/location/spec_http-location/a.txt +1 -0
  171. data/test/location/spec_http-location/b.txt +1 -0
  172. data/test/location/spec_http-location/c.txt +1 -0
  173. data/test/location/spec_http-location/dir/d.txt +1 -0
  174. data/test/location/spec_https-location.rb +37 -0
  175. data/test/rule-handler/spec_flow-handler.rb +1 -1
  176. data/test/rule-handler/spec_update-criteria.rb +1 -1
  177. data/test/test-data/package/HelloWorld+v0.1.0.ppg +0 -0
  178. data/test/test-data/package/HelloWorld-gitrepos.zip +0 -0
  179. data/test/test-data/package/HelloWorld/HelloWorld.pione +5 -0
  180. data/test/test-data/package/HelloWorld/package.yml +6 -0
  181. data/test/test-data/package/HelloWorld/scenario/output/message.txt +1 -0
  182. data/test/test-data/package/HelloWorld/scenario/scenario.yml +3 -0
  183. data/test/test-data/package/TestPackage1+v0.1.0.ppg +0 -0
  184. data/test/{component/spec_package/TestPackage → test-data/package/TestPackage1}/Test.pione +3 -1
  185. data/test/test-data/package/TestPackage1/bin/count +11 -0
  186. data/test/test-data/package/TestPackage1/package.yml +9 -0
  187. data/test/{component/spec_package/TestPackage → test-data/package/TestPackage1}/scenario/case1/input/1.txt +0 -0
  188. data/test/test-data/package/TestPackage1/scenario/case1/output/1.count +1 -0
  189. data/test/test-data/package/TestPackage1/scenario/case1/scenario.yml +6 -0
  190. data/test/test-data/package/TestPackage1/scenario/case2/input/1.txt +2 -0
  191. data/test/test-data/package/TestPackage1/scenario/case2/input/2.txt +1 -0
  192. data/test/test-data/package/TestPackage1/scenario/case2/input/3.txt +3 -0
  193. data/test/test-data/package/TestPackage1/scenario/case2/output/1.count +1 -0
  194. data/test/test-data/package/TestPackage1/scenario/case2/output/2.count +1 -0
  195. data/test/test-data/package/TestPackage1/scenario/case2/output/3.count +1 -0
  196. data/test/test-data/package/TestPackage1/scenario/case2/scenario.yml +10 -0
  197. data/test/test-data/package/TestPackage1/scenario/case3/input/a.txt +1 -0
  198. data/test/test-data/package/TestPackage1/scenario/case3/input/b.txt +1 -0
  199. data/test/test-data/package/TestPackage1/scenario/case3/output/a.count +1 -0
  200. data/test/test-data/package/TestPackage1/scenario/case3/output/b.count +1 -0
  201. data/test/test-data/package/TestPackage1/scenario/case3/scenario.yml +8 -0
  202. data/test/test-util.rb +10 -146
  203. data/test/test-util/command.rb +53 -0
  204. data/test/test-util/package.rb +9 -0
  205. data/test/test-util/parser.rb +45 -0
  206. data/test/test-util/transformer.rb +50 -0
  207. data/test/test-util/webserver.rb +43 -0
  208. data/test/util/spec_error-report.rb +12 -3
  209. data/test/util/spec_zip.rb +36 -0
  210. metadata +282 -54
  211. data/example/MakePair/scenario/scenario.yml +0 -1
  212. data/test/component/spec_package/TestPackage/bin/count +0 -3
  213. data/test/component/spec_package/TestPackage/package.yml +0 -7
  214. data/test/component/spec_package/TestPackage/scenario/case1/scenario.yml +0 -1
@@ -0,0 +1,59 @@
1
+ shared "http" do
2
+ it "should not be writable" do
3
+ location("/a.txt").should.not.be.writable
4
+ end
5
+
6
+ it "should read files" do
7
+ location("/a.txt").read.should == "A"
8
+ location("/b.txt").read.should == "AB"
9
+ location("/c.txt").read.should == "ABC"
10
+ location("/dir/d.txt").read.should == "ABCD"
11
+ end
12
+
13
+ it "should get size" do
14
+ location("/a.txt").size.should == 1
15
+ location("/b.txt").size.should == 2
16
+ location("/c.txt").size.should == 3
17
+ location("/dir/d.txt").size.should == 4
18
+ end
19
+
20
+ it "should get mtime" do
21
+ location("/a.txt").mtime.to_s.should == File.mtime(File.join(@path, "a.txt")).to_s
22
+ location("/b.txt").mtime.to_s.should == File.mtime(File.join(@path, "b.txt")).to_s
23
+ location("/c.txt").mtime.to_s.should == File.mtime(File.join(@path, "c.txt")).to_s
24
+ location("/dir/d.txt").mtime.to_s.should == File.mtime(File.join(@path, "dir", "d.txt")).to_s
25
+ end
26
+
27
+ it "should exist" do
28
+ location("/a.txt").should.exist
29
+ location("/b.txt").should.exist
30
+ location("/c.txt").should.exist
31
+ location("/dir/d.txt").should.exist
32
+ end
33
+
34
+ it "should not exist" do
35
+ location("/d.txt").should.not.exist
36
+ location("/dir").should.not.exist
37
+ end
38
+
39
+ it "should be files" do
40
+ location("/a.txt").should.be.file
41
+ location("/b.txt").should.be.file
42
+ location("/c.txt").should.be.file
43
+ location("/dir/d.txt").should.be.file
44
+ end
45
+
46
+ it "should not be files" do
47
+ location("/d.txt").should.not.file
48
+ location("/dir").should.not.file
49
+ end
50
+
51
+ it "should not be directories" do
52
+ location("/a.txt").should.not.be.directory
53
+ location("/b.txt").should.not.be.directory
54
+ location("/c.txt").should.not.be.directory
55
+ location("/dir/d.txt").should.not.be.directory
56
+ location("/d.txt").should.not.directory
57
+ location("/dir").should.not.directory
58
+ end
59
+ end
@@ -122,4 +122,12 @@ shared "location" do
122
122
  (@dir + "D").directory_entries.should.not.include(@dir + "D" + "Y")
123
123
  (@dir + "D").directory_entries.should.not.include(@dir + "D" + "Z")
124
124
  end
125
+
126
+ it "should get local location" do
127
+ @file.create("A")
128
+ local = @file.local
129
+ local.scheme.should == "local"
130
+ local.should.exist
131
+ local.should.file
132
+ end
125
133
  end
@@ -1,6 +1,6 @@
1
1
  require_relative '../test-util'
2
2
 
3
- class TestLocation < Location::BasicLocation
3
+ class TestLocation < Location::DataLocation
4
4
  set_scheme "test"
5
5
  end
6
6
 
@@ -32,4 +32,8 @@ describe 'Location::BasicLocation' do
32
32
  it 'should get basename' do
33
33
  Location["test:/a/name"].basename.should == "name"
34
34
  end
35
+
36
+ it 'should get extension name' do
37
+ Location["test:/a/name.txt"].extname.should == ".txt"
38
+ end
35
39
  end
@@ -0,0 +1,143 @@
1
+ require_relative '../test-util'
2
+
3
+ $stdout = STDOUT
4
+ $stderr = STDERR
5
+
6
+ describe "Pione::Location::GitRepositoryLocation" do
7
+ before do
8
+ Global.git_repository_directory
9
+ end
10
+
11
+ #
12
+ # test git URL handling
13
+ #
14
+
15
+ it "should get repository location of local filesystem" do
16
+ location = Location[git: "/path/to/repos.git"]
17
+ location.location_type.should == :git_repository
18
+ location.address.should == "/path/to/repos.git"
19
+ end
20
+
21
+ it "should get repository locatoion of git server" do
22
+ location = Location[git: "git://path/to/repos.git"]
23
+ location.location_type.should == :git_repository
24
+ location.address.should == "git://path/to/repos.git"
25
+ end
26
+
27
+ it "should get repository location of http" do
28
+ location = Location[git: "https://github.com/pione/pione.git"]
29
+ location.location_type.should == :git_repository
30
+ location.address.should == "https://github.com/pione/pione.git"
31
+ end
32
+
33
+ it "should get repository location of ssh" do
34
+ location = Location[git: "git@github.com:pione/pione.git"]
35
+ location.location_type.should == :git_repository
36
+ location.address.should == "git@github.com:pione/pione.git"
37
+ end
38
+
39
+ #
40
+ # test repository operations
41
+ #
42
+
43
+ shared "git repository location" do
44
+ it "should get hash id from tag" do
45
+ @location.ref(tag: "v0.1.0").should == "2bb5f582387ac04b429db26dc1c597cf0b8fc0fe"
46
+ @location.should.has_local
47
+ end
48
+
49
+ it "should get hash id from branch" do
50
+ @location.ref(branch: "master").should == "d0a3837fe04d11ac012db1994c4774a3e39c00fc"
51
+ @location.should.has_local
52
+ end
53
+
54
+ it "should get compact hash id" do
55
+ @location.compact_hash_id.should == "d0a3837"
56
+ end
57
+
58
+ it "should export repository at HEAD" do
59
+ exported = Location[Temppath.mkdir]
60
+ @location.export(exported)
61
+ (exported + "package.yml").should.exist
62
+ (exported + "scenario" + "scenario.yml").should.exist
63
+ end
64
+
65
+ it "should export repository at the hash id" do
66
+ exported = Location[Temppath.mkdir]
67
+ (@location + {hashid: "2bb5f58"}).export(exported)
68
+ (exported + "package.yml").should.exist
69
+ (exported + "scenario" + "scenario.yml").should.exist
70
+ end
71
+
72
+ it "should export repository at the tag v0.1.0" do
73
+ exported = Location[Temppath.mkdir]
74
+ (@location + {tag: "v0.1.0"}).export(exported)
75
+ (exported + "package.yml").should.exist
76
+ (exported + "scenario" + "scenario.yml").should.exist
77
+ end
78
+
79
+ it "should export repository at the branch master" do
80
+ exported = Location[Temppath.mkdir]
81
+ (@location + {branch: "master"}).export(exported)
82
+ (exported + "package.yml").should.exist
83
+ (exported + "scenario" + "scenario.yml").should.exist
84
+ end
85
+ end
86
+
87
+ describe "local" do
88
+ before do
89
+ @repos_location = Location[Temppath.mkdir]
90
+ repos_zip = TestUtil::TEST_PACKAGE_DIR + "HelloWorld-gitrepos.zip"
91
+ Util::Zip.uncompress(repos_zip, @repos_location)
92
+ end
93
+
94
+ describe "head" do
95
+ before do
96
+ @location = Location[git: @repos_location.path]
97
+ end
98
+
99
+ behaves_like "git repository location"
100
+ end
101
+
102
+ describe "with tag" do
103
+ before do
104
+ @location = Location[git: @repos_location.path, tag: "v0.1.0"]
105
+ end
106
+
107
+ behaves_like "git repository location"
108
+ end
109
+
110
+ describe "with hash id" do
111
+ before do
112
+ @location = Location[git: @repos_location.path, hash_id: "a5dd7b0"]
113
+ end
114
+
115
+ behaves_like "git repository location"
116
+ end
117
+
118
+ describe "with branch" do
119
+ before do
120
+ @location = Location[git: @repos_location.path, branch: "master"]
121
+ end
122
+
123
+ behaves_like "git repository location"
124
+ end
125
+ end
126
+
127
+ # describe "http" do
128
+ # before do
129
+ # @repos_location = Location[Temppath.mkdir]
130
+ # repos_zip = TestUtil::TEST_PACKAGE_DIR + "HelloWorld-gitrepos.zip"
131
+ # Util::Zip.uncompress(repos_zip, @repos_location)
132
+ # @server = TestUtil::WebServer.start(@repos_location)
133
+ # @location = Location[git: @server.root.uri]
134
+ # end
135
+
136
+ # after do
137
+ # @server.terminate
138
+ # end
139
+
140
+ # behaves_like "git repository location"
141
+ # end
142
+ end
143
+
@@ -0,0 +1,28 @@
1
+ require_relative "../test-util"
2
+ require_relative "http-behavior"
3
+ require 'webrick'
4
+
5
+ describe "Pione::Location::HTTPLocation" do
6
+ before do
7
+ @path = File.join(File.dirname(__FILE__), "spec_http-location")
8
+ logger = WEBrick::Log.new(StringIO.new("", "w"))
9
+ @server = WEBrick::HTTPServer.new(DocumentRoot: @path, Port: 54673, Logger: logger, AccessLog: logger)
10
+ @thread = Thread.new do
11
+ retriable(on: WEBrick::ServerError, tries: 10, interval: 2) do
12
+ @server.start
13
+ end
14
+ end
15
+ end
16
+
17
+ after do
18
+ @server.shutdown
19
+ @thread.kill
20
+ end
21
+
22
+ def location(path)
23
+ Location["http://127.0.0.1:%s%s" % [@server.config[:Port], path]]
24
+ end
25
+
26
+ behaves_like "http"
27
+ end
28
+
@@ -0,0 +1,37 @@
1
+ require_relative "../test-util"
2
+ require_relative "http-behavior"
3
+ require 'webrick'
4
+ require 'webrick/https'
5
+
6
+ describe "Pione::Location::HTTPSLocation" do
7
+ before do
8
+ @path = File.join(File.dirname(__FILE__), "spec_http-location")
9
+ logger = WEBrick::Log.new(StringIO.new("", "w"))
10
+ @server = WEBrick::HTTPServer.new(
11
+ DocumentRoot: @path,
12
+ Port: 54673,
13
+ Logger: logger,
14
+ AccessLog: logger,
15
+ SSLEnable: true,
16
+ SSLCertName: [["CN", WEBrick::Utils.getservername]]
17
+ )
18
+ @thread = Thread.new do
19
+ $stderr = StringIO.new("", "w")
20
+ retriable(on: WEBrick::ServerError, tries: 5, interval: 1) do
21
+ @server.start
22
+ end
23
+ $stderr = STDOUT
24
+ end
25
+ end
26
+
27
+ after do
28
+ @server.shutdown
29
+ @thread.kill
30
+ end
31
+
32
+ def location(path)
33
+ Location["https://127.0.0.1:%s%s" % [@server.config[:Port], path]]
34
+ end
35
+
36
+ behaves_like "http"
37
+ end
@@ -1,7 +1,7 @@
1
1
  require_relative '../test-util'
2
2
 
3
3
  location = Location[File.dirname(__FILE__)] + "spec_flow-handler.pione"
4
- $doc = Component::Document.load(location.read)
4
+ $doc = Component::Document.load(location)
5
5
 
6
6
  describe 'Pione::RuleHandler::FlowRule' do
7
7
  before do
@@ -1,7 +1,7 @@
1
1
  require_relative '../test-util'
2
2
 
3
3
  path = Pathname.new(File.join(File.dirname(__FILE__), "spec_update-criteria.pione"))
4
- document = Component::Document.load(path.read)
4
+ document = Component::Document.load(path)
5
5
 
6
6
  time = 10.times.map {sleep 0.001; Time.now}
7
7
  tuple = {}
@@ -0,0 +1,5 @@
1
+ Rule Main
2
+ output 'message.txt'
3
+ Action
4
+ echo "Hello, world!" > message.txt
5
+ End
@@ -0,0 +1,6 @@
1
+ PackageName: HelloWorld
2
+ Version: 0.1.0
3
+ Documents:
4
+ - "HelloWorld.pione"
5
+ Scenarios:
6
+ - "scenario"
@@ -0,0 +1,3 @@
1
+ ScenarioName: HelloWorld
2
+ Outputs:
3
+ - "message.txt"
@@ -1,3 +1,5 @@
1
+ param $WORD := "world"
2
+
1
3
  Rule Main
2
4
  input '*.txt'.all
3
5
  output '*.count'.all
@@ -9,6 +11,6 @@ Rule Count
9
11
  input '*.txt'
10
12
  output '{$*}.count'
11
13
  Action
12
- {$_.bin}/count {$I[1]} > {$O[1]}
14
+ count
13
15
  End
14
16
 
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "pione"
4
+
5
+ input = Pione.val "$I[1]"
6
+ output = Pione.val "$O[1]"
7
+ word = Pione.val "$WORD"
8
+
9
+ counter = 0
10
+ File.read(input).gsub(word){counter += 1}
11
+ File.write(output, counter)
@@ -0,0 +1,9 @@
1
+ PackageName: TestPackage1
2
+ Authors: Keita Yamaguchi
3
+ Tag: v0.1.0
4
+ Documents:
5
+ - Test.pione
6
+ Scenarios:
7
+ - scenario/case1
8
+ - scenario/case2
9
+ - scenario/case3
@@ -0,0 +1,6 @@
1
+ ScenarioName: Case1
2
+ Params: '{WORD: "a"}'
3
+ Inputs:
4
+ - "1.txt"
5
+ Outputs:
6
+ - "1.count"
@@ -0,0 +1,3 @@
1
+ abcabcabc
2
+ bcabcabca
3
+ cabcabcab
@@ -0,0 +1,10 @@
1
+ ScenarioName: Case2
2
+ Params: '{WORD: "abc"}'
3
+ Inputs:
4
+ - "1.txt"
5
+ - "2.txt"
6
+ - "3.txt"
7
+ Outputs:
8
+ - "1.count"
9
+ - "2.count"
10
+ - "3.count"