pione 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -13
- data/.travis.yml +1 -1
- data/History.txt +11 -0
- data/Rakefile +13 -0
- data/bin/pione-package +5 -0
- data/example/AbstractRule/package.yml +6 -0
- data/example/AbstractRule/scenario/a/output/message.txt +1 -0
- data/example/AbstractRule/scenario/a/scenario.yml +4 -0
- data/example/AbstractRule/scenario/b/output/message.txt +1 -0
- data/example/AbstractRule/scenario/b/scenario.yml +4 -0
- data/example/AbstractRule/scenario/c/output/message.txt +1 -0
- data/example/AbstractRule/scenario/c/scenario.yml +4 -0
- data/example/HelloWorld/package.yml +5 -1
- data/example/HelloWorld/scenario/scenario.yml +2 -1
- data/example/LoopByTouch/package.yml +4 -1
- data/example/MakePair/package.yml +6 -0
- data/example/MakePair/scenario/{input → case1/input}/1.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/2.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/3.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/4.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/5.i +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-2-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-2-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-2-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-3-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-3-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-4-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-1-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-2-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-3-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-4-5.pair +0 -0
- data/example/MakePair/scenario/case1/scenario.yml +42 -0
- data/example/MakePair/scenario/case2/input/10.i +0 -0
- data/example/MakePair/scenario/case2/input/11.i +0 -0
- data/example/MakePair/scenario/case2/input/9.i +0 -0
- data/example/MakePair/scenario/case2/output/comb-10-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/comb-9-10.pair +0 -0
- data/example/MakePair/scenario/case2/output/comb-9-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-10-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-10-9.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-11-10.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-11-9.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-9-10.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-9-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/succ-10-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/succ-9-10.pair +0 -0
- data/example/MakePair/scenario/case2/scenario.yml +17 -0
- data/example/MakePair/scenario/case3/input/1.i +0 -0
- data/example/MakePair/scenario/case3/input/3.i +0 -0
- data/example/MakePair/scenario/case3/input/5.i +0 -0
- data/example/MakePair/scenario/case3/input/7.i +0 -0
- data/example/MakePair/scenario/case3/input/9.i +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-3-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-3-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-3-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-5-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-5-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-7-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-7.pair +0 -0
- data/example/MakePair/scenario/case3/scenario.yml +39 -0
- data/example/PegasusWMS/Merge/Merge.pione +21 -0
- data/example/PegasusWMS/Merge/package.yml +2 -0
- data/example/PegasusWMS/Pipeline/Pipeline.pione +20 -0
- data/example/PegasusWMS/Pipeline/package.yml +2 -0
- data/example/PegasusWMS/Split/Split.pione +27 -0
- data/example/PegasusWMS/Split/package.yml +2 -0
- data/example/ScoreAggregation/package.yml +4 -0
- data/example/ScoreAggregation/scenario/case1/scenario.yml +27 -1
- data/example/SerialProcessing/package.yml +5 -1
- data/example/SerialProcessing/scenario/scenario.yml +10 -0
- data/lib/pione.rb +20 -71
- data/lib/pione/agent.rb +17 -0
- data/lib/pione/agent/basic-agent.rb +2 -4
- data/lib/pione/command.rb +1 -0
- data/lib/pione/command/option.rb +4 -1
- data/lib/pione/command/pione-package.rb +97 -0
- data/lib/pione/command/pione-task-worker.rb +11 -7
- data/lib/pione/component.rb +5 -0
- data/lib/pione/component/document.rb +22 -5
- data/lib/pione/component/package-archiver.rb +92 -0
- data/lib/pione/component/package-expander.rb +37 -0
- data/lib/pione/component/package-filename.rb +38 -0
- data/lib/pione/component/package-reader.rb +276 -0
- data/lib/pione/component/package.rb +50 -162
- data/lib/pione/front.rb +14 -0
- data/lib/pione/location.rb +5 -0
- data/lib/pione/location/basic-location.rb +47 -274
- data/lib/pione/location/data-location.rb +328 -0
- data/lib/pione/location/dropbox-location.rb +30 -7
- data/lib/pione/location/exception.rb +38 -0
- data/lib/pione/location/ftp-location.rb +24 -13
- data/lib/pione/location/git-repository-location.rb +153 -0
- data/lib/pione/location/http-location.rb +65 -0
- data/lib/pione/location/https-location.rb +37 -0
- data/lib/pione/location/local-location.rb +24 -5
- data/lib/pione/parser.rb +14 -0
- data/lib/pione/patch.rb +10 -0
- data/lib/pione/patch/drb-patch.rb +2 -2
- data/lib/pione/relay.rb +11 -0
- data/lib/pione/system/file-cache.rb +1 -1
- data/lib/pione/system/global.rb +15 -0
- data/lib/pione/tuple-space.rb +11 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +1 -1
- data/lib/pione/util.rb +1 -0
- data/lib/pione/util/error-report.rb +7 -0
- data/lib/pione/util/misc.rb +2 -2
- data/lib/pione/util/zip.rb +60 -0
- data/lib/pione/version.rb +1 -1
- data/pione.gemspec +5 -1
- data/test/agent/spec_rule-provider.rb +2 -2
- data/test/command/spec_pione-package.rb +15 -0
- data/test/component/spec_document.rb +2 -2
- data/test/component/spec_package-archiver.rb +27 -0
- data/test/component/spec_package-expander.rb +11 -0
- data/test/component/spec_package-filename.rb +79 -0
- data/test/component/spec_package-reader.rb +100 -0
- data/test/component/spec_package.rb +50 -33
- data/test/location/http-behavior.rb +59 -0
- data/test/location/location-behavior.rb +8 -0
- data/test/location/spec_basic-location.rb +5 -1
- data/test/location/spec_git-repository-location.rb +143 -0
- data/test/location/spec_http-location.rb +28 -0
- data/test/location/spec_http-location/a.txt +1 -0
- data/test/location/spec_http-location/b.txt +1 -0
- data/test/location/spec_http-location/c.txt +1 -0
- data/test/location/spec_http-location/dir/d.txt +1 -0
- data/test/location/spec_https-location.rb +37 -0
- data/test/rule-handler/spec_flow-handler.rb +1 -1
- data/test/rule-handler/spec_update-criteria.rb +1 -1
- data/test/test-data/package/HelloWorld+v0.1.0.ppg +0 -0
- data/test/test-data/package/HelloWorld-gitrepos.zip +0 -0
- data/test/test-data/package/HelloWorld/HelloWorld.pione +5 -0
- data/test/test-data/package/HelloWorld/package.yml +6 -0
- data/test/test-data/package/HelloWorld/scenario/output/message.txt +1 -0
- data/test/test-data/package/HelloWorld/scenario/scenario.yml +3 -0
- data/test/test-data/package/TestPackage1+v0.1.0.ppg +0 -0
- data/test/{component/spec_package/TestPackage → test-data/package/TestPackage1}/Test.pione +3 -1
- data/test/test-data/package/TestPackage1/bin/count +11 -0
- data/test/test-data/package/TestPackage1/package.yml +9 -0
- data/test/{component/spec_package/TestPackage → test-data/package/TestPackage1}/scenario/case1/input/1.txt +0 -0
- data/test/test-data/package/TestPackage1/scenario/case1/output/1.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case1/scenario.yml +6 -0
- data/test/test-data/package/TestPackage1/scenario/case2/input/1.txt +2 -0
- data/test/test-data/package/TestPackage1/scenario/case2/input/2.txt +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/input/3.txt +3 -0
- data/test/test-data/package/TestPackage1/scenario/case2/output/1.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/output/2.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/output/3.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/scenario.yml +10 -0
- data/test/test-data/package/TestPackage1/scenario/case3/input/a.txt +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/input/b.txt +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/output/a.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/output/b.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/scenario.yml +8 -0
- data/test/test-util.rb +10 -146
- data/test/test-util/command.rb +53 -0
- data/test/test-util/package.rb +9 -0
- data/test/test-util/parser.rb +45 -0
- data/test/test-util/transformer.rb +50 -0
- data/test/test-util/webserver.rb +43 -0
- data/test/util/spec_error-report.rb +12 -3
- data/test/util/spec_zip.rb +36 -0
- metadata +282 -54
- data/example/MakePair/scenario/scenario.yml +0 -1
- data/test/component/spec_package/TestPackage/bin/count +0 -3
- data/test/component/spec_package/TestPackage/package.yml +0 -7
- data/test/component/spec_package/TestPackage/scenario/case1/scenario.yml +0 -1
data/lib/pione/util/misc.rb
CHANGED
@@ -0,0 +1,60 @@
|
|
1
|
+
module Pione
|
2
|
+
module Util
|
3
|
+
module Zip
|
4
|
+
class << self
|
5
|
+
# Create a zip archive of the location.
|
6
|
+
#
|
7
|
+
# @param src [DataLocation]
|
8
|
+
# the source directory location
|
9
|
+
# @param archive [DataLocation]
|
10
|
+
# the archive location
|
11
|
+
def compress(src, archive)
|
12
|
+
# src should be a directory
|
13
|
+
raise ArgumentError.new(src) unless src.directory?
|
14
|
+
|
15
|
+
# make local path
|
16
|
+
_src = src.local
|
17
|
+
_archive = Location[Temppath.create]
|
18
|
+
|
19
|
+
# compress
|
20
|
+
::Zip::Archive.open(_archive.path.to_s, ::Zip::CREATE) do |ar|
|
21
|
+
_src.rel_entries(rec: true).each do |relpath|
|
22
|
+
relpath = relpath.to_s
|
23
|
+
location = _src + relpath
|
24
|
+
if location.directory?
|
25
|
+
ar.add_dir(relpath)
|
26
|
+
else
|
27
|
+
ar.add_file(relpath, location.path.to_s)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# upload archive
|
33
|
+
_archive.move(archive)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Expand the archive into the destination directory.
|
37
|
+
#
|
38
|
+
# @param archive [DataLocation]
|
39
|
+
# the archive location
|
40
|
+
# @param dest [DataLocation]
|
41
|
+
# the destination directory location
|
42
|
+
def uncompress(archive, dest)
|
43
|
+
_archive = archive.local
|
44
|
+
_dest = dest.local
|
45
|
+
::Zip::Archive.open(_archive.path.to_s) do |ar|
|
46
|
+
ar.each do |f|
|
47
|
+
path = _dest + f.name
|
48
|
+
if f.directory?
|
49
|
+
path.mkdir
|
50
|
+
else
|
51
|
+
f.read(8192) {|chunk| path.append(chunk)}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
_dest.move(dest)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/pione/version.rb
CHANGED
data/pione.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |gem|
|
|
32
32
|
gem.add_dependency "hamster", "~> 0.4.3"
|
33
33
|
gem.add_dependency "naming", "~> 0.1.0"
|
34
34
|
gem.add_dependency "forwardablex", "~> 0.1.4"
|
35
|
-
gem.add_dependency "temppath", "~> 0.
|
35
|
+
gem.add_dependency "temppath", "~> 0.2.0"
|
36
36
|
gem.add_dependency "ruby-xes", "~> 0.1.0"
|
37
37
|
gem.add_dependency "sys-uname", "~> 0.9.2"
|
38
38
|
gem.add_dependency "simple-identity", "~> 0.1.1"
|
@@ -40,6 +40,10 @@ Gem::Specification.new do |gem|
|
|
40
40
|
gem.add_dependency "sys-cpu", "~> 0.7.1"
|
41
41
|
gem.add_dependency "structx", "~> 0.1.0"
|
42
42
|
gem.add_dependency "syslog-logger", "~> 1.6.8"
|
43
|
+
gem.add_dependency "zipruby", "~> 0.3.6"
|
44
|
+
gem.add_dependency "retriable", "~> 1.3.3"
|
45
|
+
gem.add_dependency "childprocess", "~> 0.3.9"
|
46
|
+
gem.add_dependency "git", "~> 1.2.5"
|
43
47
|
|
44
48
|
# for locations
|
45
49
|
gem.add_dependency "dropbox-sdk", "~> 1.5.1"
|
@@ -4,7 +4,7 @@ describe "Pione::Agent::RuleProvider" do
|
|
4
4
|
before do
|
5
5
|
@ts = create_tuple_space_server
|
6
6
|
@agent = Agent[:rule_provider].new(@ts)
|
7
|
-
doc = Component::Document.
|
7
|
+
doc = Component::Document.parse(<<-DOCUMENT)
|
8
8
|
Rule A
|
9
9
|
input '*.a'
|
10
10
|
output '{$I[1]}.result'
|
@@ -35,7 +35,7 @@ describe "Pione::Agent::RuleProvider" do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should add a rule" do
|
38
|
-
doc = Component::Document.
|
38
|
+
doc = Component::Document.parse(<<-DOCUMENT)
|
39
39
|
Rule C
|
40
40
|
input '*.c'
|
41
41
|
output '{$I[1]}.result'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative "../test-util"
|
2
|
+
|
3
|
+
describe "Pione::Command::PionePackage" do
|
4
|
+
it "should build PIONE package" do
|
5
|
+
package_location = TestUtil::Package.get("TestPackage1")
|
6
|
+
output_location = Location[Temppath.mkdir]
|
7
|
+
res = TestUtil::Command.succeed do
|
8
|
+
Command::PionePackage.run ["--build", "-o", output_location.path.to_s, package_location.path.to_s]
|
9
|
+
end
|
10
|
+
pkg = output_location + "TestPackage1+v0.1.0.ppg"
|
11
|
+
pkg.should.exist
|
12
|
+
pkg.size.should > 0
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -17,7 +17,7 @@ describe 'Pione::Component::Document' do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should load a document from a string' do
|
20
|
-
Component::Document.
|
20
|
+
Component::Document.parse(document_location.read).should == @document
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should load a document with package name' do
|
@@ -58,7 +58,7 @@ describe 'Pione::Component::Document' do
|
|
58
58
|
|
59
59
|
it 'should raise variable binding error' do
|
60
60
|
should.raise(VariableBindingError) do
|
61
|
-
Component::Document.
|
61
|
+
Component::Document.parse <<-PIONE
|
62
62
|
$X := 1
|
63
63
|
$X := 2
|
64
64
|
PIONE
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe "Pione::Component::PackageArchiver" do
|
4
|
+
before do
|
5
|
+
@path = TestUtil::Package.get("TestPackage1")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should create archive file" do
|
9
|
+
out = Location[Temppath.mkdir]
|
10
|
+
Component::PackageArchiver.new(@path).archive(out)
|
11
|
+
|
12
|
+
# easy check
|
13
|
+
pkg = out + "TestPackage1+v0.1.0.ppg"
|
14
|
+
pkg.should.exist
|
15
|
+
pkg.should.file
|
16
|
+
pkg.size.should > 0
|
17
|
+
|
18
|
+
# structure check
|
19
|
+
Zip::Archive.open(pkg.path.to_s) do |ar|
|
20
|
+
ar.each do |file|
|
21
|
+
unless file.directory?
|
22
|
+
file.read.should == (@path + file.name).read
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe "Pione::Component::PackageExpander" do
|
4
|
+
it "should expand archive package" do
|
5
|
+
location = TestUtil::TEST_PACKAGE_DIR + "TestPackage1+v0.1.0.ppg"
|
6
|
+
expanded = Location[Temppath.mkdir]
|
7
|
+
Component::PackageExpander.new(location).expand(expanded)
|
8
|
+
(expanded + "package.yml").should.exist
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
shared "package filename" do
|
4
|
+
it "should parse the package filename" do
|
5
|
+
Component::PackageFilename.parse(@filename).tap do |fname|
|
6
|
+
fname.package_name.should == @package_name
|
7
|
+
fname.edition.should == @edition
|
8
|
+
fname.tag.should == @tag
|
9
|
+
fname.hash_id.should == @hash_id
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should build package filename string" do
|
14
|
+
Component::PackageFilename.parse(@filename).to_s.should == @filename
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "Pione::Component::PackageFilename" do
|
19
|
+
describe "package name + edition + tag + hash_id" do
|
20
|
+
before do
|
21
|
+
@filename = "Test(keita.yamaguchi@gmail.com)+test@d462c59.ppg"
|
22
|
+
@package_name = "Test"
|
23
|
+
@edition = "keita.yamaguchi@gmail.com"
|
24
|
+
@tag = "test"
|
25
|
+
@hash_id = "d462c59"
|
26
|
+
end
|
27
|
+
|
28
|
+
behaves_like "package filename"
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "package name + 'origin' + tag + hash_id" do
|
32
|
+
before do
|
33
|
+
@filename = "Test+test@d462c59.ppg"
|
34
|
+
@package_name = "Test"
|
35
|
+
@edition = "origin"
|
36
|
+
@tag = "test"
|
37
|
+
@hash_id = "d462c59"
|
38
|
+
end
|
39
|
+
|
40
|
+
behaves_like "package filename"
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "package name + tag + hash_id" do
|
44
|
+
before do
|
45
|
+
@filename = "Test+test@d462c59.ppg"
|
46
|
+
@package_name = "Test"
|
47
|
+
@edition = "origin"
|
48
|
+
@tag = "test"
|
49
|
+
@hash_id = "d462c59"
|
50
|
+
end
|
51
|
+
|
52
|
+
behaves_like "package filename"
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "package name + tag" do
|
56
|
+
before do
|
57
|
+
@filename = "Test+test.ppg"
|
58
|
+
@package_name = "Test"
|
59
|
+
@edition = "origin"
|
60
|
+
@tag = "test"
|
61
|
+
@hash_id = nil
|
62
|
+
end
|
63
|
+
|
64
|
+
behaves_like "package filename"
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "package name + hash id" do
|
68
|
+
before do
|
69
|
+
@filename = "Test@d462c59.ppg"
|
70
|
+
@package_name = "Test"
|
71
|
+
@edition = "origin"
|
72
|
+
@tag = nil
|
73
|
+
@hash_id = "d462c59"
|
74
|
+
end
|
75
|
+
|
76
|
+
behaves_like "package filename"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
$stdout = STDOUT
|
4
|
+
$stderr = STDERR
|
5
|
+
|
6
|
+
describe "Pione::Component::PackageReader" do
|
7
|
+
shared "package" do
|
8
|
+
it "should read the package and return it" do
|
9
|
+
Component::PackageReader.read(@location).should.kind_of Component::Package
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should get package informations" do
|
13
|
+
package = Component::PackageReader.read(@location)
|
14
|
+
package.name.should == "HelloWorld"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should get scenarios" do
|
18
|
+
package = Component::PackageReader.read(@location)
|
19
|
+
package.name.should == "HelloWorld"
|
20
|
+
scenario = package.scenarios[0]
|
21
|
+
scenario.name.should == "HelloWorld"
|
22
|
+
scenario.inputs.should.empty
|
23
|
+
scenario.outputs[0].basename.should == "message.txt"
|
24
|
+
|
25
|
+
# case1 = package.scenarios[0]
|
26
|
+
# case1.name.should == "Case1"
|
27
|
+
# case1.inputs[0].basename.should == "1.txt"
|
28
|
+
# case2 = package.scenarios[1]
|
29
|
+
# case2.name.should == "Case2"
|
30
|
+
# case2.inputs[0].basename.should == "1.txt"
|
31
|
+
# case2.inputs[1].basename.should == "2.txt"
|
32
|
+
# case2.inputs[2].basename.should == "3.txt"
|
33
|
+
# case3 = package.scenarios[2]
|
34
|
+
# case3.name.should == "Case3"
|
35
|
+
# case3.inputs[0].basename.should == "a.txt"
|
36
|
+
# case3.inputs[1].basename.should == "b.txt"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
shared "directory package" do
|
41
|
+
it "should read package directory" do
|
42
|
+
Component::PackageReader.new(@location).type.should == :directory
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "directory package at local location" do
|
47
|
+
before do
|
48
|
+
@location = TestUtil::Package.get("HelloWorld")
|
49
|
+
end
|
50
|
+
|
51
|
+
behaves_like "package"
|
52
|
+
behaves_like "directory package"
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "directory package at HTTP location" do
|
56
|
+
before do
|
57
|
+
@server = TestUtil::WebServer.start(TestUtil::TEST_PACKAGE_DIR)
|
58
|
+
@location = @server.root + "HelloWorld/"
|
59
|
+
end
|
60
|
+
|
61
|
+
after do
|
62
|
+
@server.terminate
|
63
|
+
end
|
64
|
+
|
65
|
+
behaves_like "package"
|
66
|
+
behaves_like "directory package"
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "archive package at local location" do
|
70
|
+
before do
|
71
|
+
@location = TestUtil::TEST_PACKAGE_DIR + "HelloWorld+v0.1.0.ppg"
|
72
|
+
end
|
73
|
+
|
74
|
+
behaves_like "package"
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "archive package at HTTP location" do
|
78
|
+
before do
|
79
|
+
@server = TestUtil::WebServer.start(TestUtil::TEST_PACKAGE_DIR)
|
80
|
+
@location = @server.root + "HelloWorld+v0.1.0.ppg"
|
81
|
+
end
|
82
|
+
|
83
|
+
after do
|
84
|
+
@server.terminate
|
85
|
+
end
|
86
|
+
|
87
|
+
behaves_like "package"
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "git package at local location" do
|
91
|
+
before do
|
92
|
+
path = Temppath.mkdir
|
93
|
+
Util::Zip.uncompress(TestUtil::TEST_PACKAGE_DIR + "HelloWorld-gitrepos.zip", Location[path])
|
94
|
+
@location = Location[git: path]
|
95
|
+
end
|
96
|
+
|
97
|
+
behaves_like "package"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
@@ -2,23 +2,25 @@ require_relative '../test-util'
|
|
2
2
|
|
3
3
|
describe "Pione::Component::Package" do
|
4
4
|
before do
|
5
|
-
|
6
|
-
@package = Component::PackageReader.new(
|
7
|
-
@
|
5
|
+
@location = TestUtil::Package.get("TestPackage1")
|
6
|
+
@package = Component::PackageReader.new(@location).read
|
7
|
+
@case1 = @package.scenarios[0]
|
8
|
+
@case2 = @package.scenarios[1]
|
9
|
+
@case3 = @package.scenarios[2]
|
8
10
|
end
|
9
11
|
|
10
12
|
it "should equal" do
|
11
|
-
Component::Package.new({"
|
12
|
-
Component::Package.new({"
|
13
|
+
Component::Package.new(location: @location, info: {"PackageName1" => "Test"}).should ==
|
14
|
+
Component::Package.new(location: @location, info: {"PackageName1" => "Test"})
|
13
15
|
end
|
14
16
|
|
15
17
|
it "should not equal" do
|
16
|
-
Component::Package.new({"
|
17
|
-
Component::Package.new({"
|
18
|
+
Component::Package.new(location: @location, info: {"PackageName1" => "Test1"}).should !=
|
19
|
+
Component::Package.new(location: @location, info: {"PackageName1" => "Test2"})
|
18
20
|
end
|
19
21
|
|
20
22
|
it "should get the package name" do
|
21
|
-
@package.name.should == "
|
23
|
+
@package.name.should == "TestPackage1"
|
22
24
|
end
|
23
25
|
|
24
26
|
it "should get bin" do
|
@@ -26,7 +28,10 @@ describe "Pione::Component::Package" do
|
|
26
28
|
end
|
27
29
|
|
28
30
|
it "should get scenarios" do
|
29
|
-
@package.scenarios.map{|scenario| scenario.name}
|
31
|
+
names = @package.scenarios.map{|scenario| scenario.name}
|
32
|
+
names.should.include "Case1"
|
33
|
+
names.should.include "Case2"
|
34
|
+
names.should.include "Case3"
|
30
35
|
end
|
31
36
|
|
32
37
|
it "should get docuemtns" do
|
@@ -35,13 +40,13 @@ describe "Pione::Component::Package" do
|
|
35
40
|
|
36
41
|
it "should get rules" do
|
37
42
|
@package.rules.map{|rule| rule.path}.tap do |x|
|
38
|
-
x.should.include("&
|
39
|
-
x.should.include("&
|
43
|
+
x.should.include("&TestPackage1:Main")
|
44
|
+
x.should.include("&TestPackage1:Count")
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
43
48
|
it "should get a main rule" do
|
44
|
-
@package.find_rule("Main").path.should == "&
|
49
|
+
@package.find_rule("Main").path.should == "&TestPackage1:Main"
|
45
50
|
end
|
46
51
|
|
47
52
|
it "should upload package files" do
|
@@ -52,41 +57,53 @@ describe "Pione::Component::Package" do
|
|
52
57
|
end
|
53
58
|
|
54
59
|
it "should find sceinarios" do
|
55
|
-
@package.find_scenario(:anything).name.should == "
|
56
|
-
@package.find_scenario("
|
60
|
+
@package.find_scenario(:anything).name.should == "Case1"
|
61
|
+
@package.find_scenario("Case1").name.should == "Case1"
|
62
|
+
@package.find_scenario("Case2").name.should == "Case2"
|
63
|
+
@package.find_scenario("Case3").name.should == "Case3"
|
57
64
|
end
|
58
65
|
end
|
59
66
|
|
60
67
|
describe "Pione::Component::PackageScenario" do
|
61
68
|
before do
|
62
|
-
@
|
63
|
-
@
|
69
|
+
@location = TestUtil::Package.get("TestPackage1")
|
70
|
+
@case1 = Component::PackageScenarioReader.new(@location, "scenario/case1").read
|
71
|
+
@case2 = Component::PackageScenarioReader.new(@location, "scenario/case2").read
|
72
|
+
@case3 = Component::PackageScenarioReader.new(@location, "scenario/case3").read
|
64
73
|
end
|
65
74
|
|
66
75
|
it 'should equal' do
|
67
|
-
Component::PackageScenario.new(@
|
68
|
-
Component::PackageScenario.new(@
|
76
|
+
Component::PackageScenario.new(@location, "scenario/case1", {"ScenarioName" => "Test"}).should ==
|
77
|
+
Component::PackageScenario.new(@location, "scenario/case1", {"ScenarioName" => "Test"})
|
69
78
|
end
|
70
79
|
|
71
80
|
it 'should not equal' do
|
72
|
-
Component::PackageScenario.new(@
|
73
|
-
Component::PackageScenario.new(@path, {"ScenarioName" => "Test2"})
|
81
|
+
Component::PackageScenario.new(@location, "scenario/case1", {"ScenarioName" => "Test1"}).should !=
|
82
|
+
Component::PackageScenario.new(@path, "scenario/case1", {"ScenarioName" => "Test2"})
|
74
83
|
end
|
75
84
|
|
76
85
|
it "should get the scenario name" do
|
77
|
-
@
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
it "should
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
@case1.name.should == "Case1"
|
87
|
+
@case2.name.should == "Case2"
|
88
|
+
@case3.name.should == "Case3"
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should get input files" do
|
92
|
+
@case1.inputs[0].basename.should == "1.txt"
|
93
|
+
@case2.inputs[0].basename.should == "1.txt"
|
94
|
+
@case2.inputs[1].basename.should == "2.txt"
|
95
|
+
@case2.inputs[2].basename.should == "3.txt"
|
96
|
+
@case3.inputs[0].basename.should == "a.txt"
|
97
|
+
@case3.inputs[1].basename.should == "b.txt"
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should get output files" do
|
101
|
+
@case1.outputs[0].basename.should == "1.count"
|
102
|
+
@case2.outputs[0].basename.should == "1.count"
|
103
|
+
@case2.outputs[1].basename.should == "2.count"
|
104
|
+
@case2.outputs[2].basename.should == "3.count"
|
105
|
+
@case3.outputs[0].basename.should == "a.count"
|
106
|
+
@case3.outputs[1].basename.should == "b.count"
|
90
107
|
end
|
91
108
|
end
|
92
109
|
|