lock_jar 0.10.0 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +59 -59
- data/.travis.yml +8 -8
- data/CHANGELOG.md +30 -21
- data/Gemfile +13 -13
- data/Guardfile +9 -9
- data/README.md +375 -375
- data/Rakefile +24 -24
- data/bundler/Gemfile +21 -21
- data/bundler/LICENSE.txt +22 -22
- data/bundler/README.md +29 -29
- data/bundler/Rakefile +2 -2
- data/bundler/lib/lock_jar_bundler/bundler.rb +35 -35
- data/bundler/lib/lock_jar_bundler/piggy_back.rb +97 -97
- data/bundler/lib/lock_jar_bundler/version.rb +5 -5
- data/bundler/lib/lock_jar_bundler.rb +4 -4
- data/bundler/lock_jar_bundler.gemspec +24 -24
- data/bundler/spec/Jarfile +2 -2
- data/bundler/spec/dummy_gem/dummy_gem.gemspec +19 -19
- data/bundler/spec/lock_jar_bundler_spec.rb +48 -48
- data/bundler/spec/spec_helper.rb +88 -88
- data/lib/lock_jar/buildr.rb +144 -144
- data/lib/lock_jar/bundler.rb +154 -154
- data/lib/lock_jar/cli.rb +64 -64
- data/lib/lock_jar/domain/artifact.rb +123 -123
- data/lib/lock_jar/domain/dsl.rb +187 -187
- data/lib/lock_jar/domain/dsl_helper.rb +83 -83
- data/lib/lock_jar/domain/gem_dsl.rb +44 -44
- data/lib/lock_jar/domain/jarfile_dsl.rb +46 -46
- data/lib/lock_jar/domain/lockfile.rb +113 -113
- data/lib/lock_jar/maven.rb +111 -111
- data/lib/lock_jar/registry.rb +92 -92
- data/lib/lock_jar/resolver.rb +95 -95
- data/lib/lock_jar/runtime.rb +359 -355
- data/lib/lock_jar/version.rb +3 -3
- data/lib/lock_jar.rb +172 -177
- data/lock_jar.gemspec +27 -27
- data/spec/fixtures/Jarfile +13 -13
- data/spec/fixtures/Jarfile2 +1 -0
- data/spec/lock_jar/class_loader_spec.rb +57 -57
- data/spec/lock_jar/cli_spec.rb +100 -100
- data/spec/lock_jar/domain/dsl_helper_spec.rb +52 -52
- data/spec/lock_jar/domain/dsl_spec.rb +57 -57
- data/spec/lock_jar/maven_spec.rb +23 -23
- data/spec/lock_jar/resolver_spec.rb +26 -26
- data/spec/lock_jar/runtime_spec.rb +26 -26
- data/spec/lock_jar_spec.rb +372 -295
- data/spec/pom.xml +34 -34
- data/spec/spec_helper.rb +38 -38
- data/spec/support/helper.rb +44 -44
- metadata +3 -1
data/spec/lock_jar/cli_spec.rb
CHANGED
@@ -1,100 +1,100 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "lockjar" do
|
4
|
-
|
5
|
-
include Spec::Helpers
|
6
|
-
|
7
|
-
before(:all) do
|
8
|
-
install_jarfile <<-J
|
9
|
-
jar "com.google.guava:guava:14.0.1"
|
10
|
-
J
|
11
|
-
end
|
12
|
-
|
13
|
-
after(:all) do
|
14
|
-
FileUtils.rm("Jarfile")
|
15
|
-
FileUtils.rm("Jarfile.lock") rescue nil
|
16
|
-
end
|
17
|
-
|
18
|
-
context "version" do
|
19
|
-
|
20
|
-
it "should return correct version" do
|
21
|
-
lockjar "version"
|
22
|
-
expect(@out).to eq(LockJar::VERSION)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context "lock" do
|
27
|
-
it "should create lock file with default path" do
|
28
|
-
FileUtils.rm("Jarfile.lock") rescue nil
|
29
|
-
lockjar "lock"
|
30
|
-
expect(@out).to match(/^Locking Jarfile to Jarfile.lock.*/)
|
31
|
-
expect(File.exists?("Jarfile.lock")).to be_true
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should create lock file with specific path" do
|
35
|
-
jarfile_path = File.join("spec", "support", "Jarfile")
|
36
|
-
jarfile_lock_path = File.join("spec", "support", "Jarfile.lock")
|
37
|
-
FileUtils.rm(jarfile_lock_path) rescue nil
|
38
|
-
|
39
|
-
lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
|
40
|
-
expect(@out).to eq("Locking #{jarfile_path} to #{jarfile_lock_path}")
|
41
|
-
expect(File.exists?(jarfile_lock_path)).to be_true
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "list" do
|
46
|
-
|
47
|
-
it "should list with default path" do
|
48
|
-
FileUtils.rm("Jarfile.lock") rescue nil
|
49
|
-
lockjar "lock"
|
50
|
-
|
51
|
-
expect_output =<<-EOM.strip
|
52
|
-
Listing Jars from Jarfile.lock for ["default"]
|
53
|
-
["com.google.guava:guava:jar:14.0.1"]
|
54
|
-
EOM
|
55
|
-
|
56
|
-
lockjar "list"
|
57
|
-
expect(@out).to eq(expect_output)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should list with specific path" do
|
61
|
-
jarfile_path = File.join("spec", "support", "Jarfile")
|
62
|
-
jarfile_lock_path = File.join("spec", "support", "Jarfile.lock")
|
63
|
-
FileUtils.rm(jarfile_lock_path) rescue nil
|
64
|
-
lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
|
65
|
-
|
66
|
-
expect_expr = Regexp.new(<<-'EOM'.strip)
|
67
|
-
Listing Jars from .*Jarfile.lock for \["default"\]
|
68
|
-
\["com.google.guava:guava:jar:14.0.1"\]
|
69
|
-
EOM
|
70
|
-
|
71
|
-
lockjar "list -l #{jarfile_lock_path}"
|
72
|
-
expect(@out).to match(expect_expr)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context "install" do
|
77
|
-
it "should install jar archives with default path" do
|
78
|
-
FileUtils.rm("Jarfile.lock") rescue nil
|
79
|
-
lockjar "lock"
|
80
|
-
|
81
|
-
lockjar "install"
|
82
|
-
expect(@out).to eq("Installing Jars from Jarfile.lock for [\"default\"]")
|
83
|
-
LockJar.load
|
84
|
-
expect(Java::ComGoogleCommonCollect::Multimap).to be_kind_of(Module) if is_jruby?
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should install jar archives with specific path" do
|
88
|
-
jarfile_path = File.join("spec", "support", "Jarfile")
|
89
|
-
jarfile_lock_path = File.join("spec", "support", "Jarfile.lock")
|
90
|
-
FileUtils.rm(jarfile_lock_path) rescue nil
|
91
|
-
lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
|
92
|
-
|
93
|
-
lockjar "install -l #{jarfile_lock_path}"
|
94
|
-
expect(@out).to eq("Installing Jars from #{jarfile_lock_path} for [\"default\"]")
|
95
|
-
LockJar.load(jarfile_lock_path)
|
96
|
-
expect(Java::ComGoogleCommonCollect::Multimap).to be_kind_of(Module) if is_jruby?
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "lockjar" do
|
4
|
+
|
5
|
+
include Spec::Helpers
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
install_jarfile <<-J
|
9
|
+
jar "com.google.guava:guava:14.0.1"
|
10
|
+
J
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:all) do
|
14
|
+
FileUtils.rm("Jarfile")
|
15
|
+
FileUtils.rm("Jarfile.lock") rescue nil
|
16
|
+
end
|
17
|
+
|
18
|
+
context "version" do
|
19
|
+
|
20
|
+
it "should return correct version" do
|
21
|
+
lockjar "version"
|
22
|
+
expect(@out).to eq(LockJar::VERSION)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "lock" do
|
27
|
+
it "should create lock file with default path" do
|
28
|
+
FileUtils.rm("Jarfile.lock") rescue nil
|
29
|
+
lockjar "lock"
|
30
|
+
expect(@out).to match(/^Locking Jarfile to Jarfile.lock.*/)
|
31
|
+
expect(File.exists?("Jarfile.lock")).to be_true
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should create lock file with specific path" do
|
35
|
+
jarfile_path = File.join("spec", "support", "Jarfile")
|
36
|
+
jarfile_lock_path = File.join("spec", "support", "Jarfile.lock")
|
37
|
+
FileUtils.rm(jarfile_lock_path) rescue nil
|
38
|
+
|
39
|
+
lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
|
40
|
+
expect(@out).to eq("Locking #{jarfile_path} to #{jarfile_lock_path}")
|
41
|
+
expect(File.exists?(jarfile_lock_path)).to be_true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "list" do
|
46
|
+
|
47
|
+
it "should list with default path" do
|
48
|
+
FileUtils.rm("Jarfile.lock") rescue nil
|
49
|
+
lockjar "lock"
|
50
|
+
|
51
|
+
expect_output =<<-EOM.strip
|
52
|
+
Listing Jars from Jarfile.lock for ["default"]
|
53
|
+
["com.google.guava:guava:jar:14.0.1"]
|
54
|
+
EOM
|
55
|
+
|
56
|
+
lockjar "list"
|
57
|
+
expect(@out).to eq(expect_output)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should list with specific path" do
|
61
|
+
jarfile_path = File.join("spec", "support", "Jarfile")
|
62
|
+
jarfile_lock_path = File.join("spec", "support", "Jarfile.lock")
|
63
|
+
FileUtils.rm(jarfile_lock_path) rescue nil
|
64
|
+
lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
|
65
|
+
|
66
|
+
expect_expr = Regexp.new(<<-'EOM'.strip)
|
67
|
+
Listing Jars from .*Jarfile.lock for \["default"\]
|
68
|
+
\["com.google.guava:guava:jar:14.0.1"\]
|
69
|
+
EOM
|
70
|
+
|
71
|
+
lockjar "list -l #{jarfile_lock_path}"
|
72
|
+
expect(@out).to match(expect_expr)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "install" do
|
77
|
+
it "should install jar archives with default path" do
|
78
|
+
FileUtils.rm("Jarfile.lock") rescue nil
|
79
|
+
lockjar "lock"
|
80
|
+
|
81
|
+
lockjar "install"
|
82
|
+
expect(@out).to eq("Installing Jars from Jarfile.lock for [\"default\"]")
|
83
|
+
LockJar.load
|
84
|
+
expect(Java::ComGoogleCommonCollect::Multimap).to be_kind_of(Module) if is_jruby?
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should install jar archives with specific path" do
|
88
|
+
jarfile_path = File.join("spec", "support", "Jarfile")
|
89
|
+
jarfile_lock_path = File.join("spec", "support", "Jarfile.lock")
|
90
|
+
FileUtils.rm(jarfile_lock_path) rescue nil
|
91
|
+
lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
|
92
|
+
|
93
|
+
lockjar "install -l #{jarfile_lock_path}"
|
94
|
+
expect(@out).to eq("Installing Jars from #{jarfile_lock_path} for [\"default\"]")
|
95
|
+
LockJar.load(jarfile_lock_path)
|
96
|
+
expect(Java::ComGoogleCommonCollect::Multimap).to be_kind_of(Module) if is_jruby?
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -1,52 +1,52 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require 'lock_jar/domain/dsl_helper'
|
4
|
-
|
5
|
-
describe LockJar::Domain::DslHelper do
|
6
|
-
|
7
|
-
it "should merge dsl" do
|
8
|
-
block1 = LockJar::Domain::Dsl.create do
|
9
|
-
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
10
|
-
|
11
|
-
jar "org.apache.mina:mina-core:2.0.4"
|
12
|
-
pom 'spec/pom.xml'
|
13
|
-
|
14
|
-
group 'runtime' do
|
15
|
-
jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
|
16
|
-
end
|
17
|
-
|
18
|
-
group 'test' do
|
19
|
-
jar 'junit:junit:jar:4.10'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
block2 = LockJar::Domain::Dsl.create do
|
24
|
-
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
25
|
-
repository 'http://new-repo'
|
26
|
-
|
27
|
-
jar "org.apache.mina:mina-core:2.0.4"
|
28
|
-
jar "compile-jar"
|
29
|
-
|
30
|
-
group 'runtime' do
|
31
|
-
jar 'runtime-jar'
|
32
|
-
pom 'runtime-pom.xml'
|
33
|
-
end
|
34
|
-
|
35
|
-
group 'test' do
|
36
|
-
jar 'test-jar'
|
37
|
-
pom 'test-pom.xml'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
dsl = LockJar::Domain::DslHelper.merge( block1, block2 )
|
42
|
-
|
43
|
-
dsl.artifacts['default'].should =~ [LockJar::Domain::Jar.new("org.apache.mina:mina-core:2.0.4"), LockJar::Domain::Pom.new("spec/pom.xml",["runtime", "compile"]), LockJar::Domain::Jar.new("compile-jar")]
|
44
|
-
|
45
|
-
# "runtime" => [LockJar::Domain::Jar.new("org.apache.tomcat:servlet-api:jar:6.0.35"), LockJar::Domain::Jar.new("runtime-jar"), LockJar::Domain::Pom.new("runtime-pom.xml")],
|
46
|
-
# "test" => [LockJar::Domain::Jar.new("junit:junit:jar:4.10"), LockJar::Domain::Jar.new("test-jar"), LockJar::Domain::Pom.new("test-pom.xml")]
|
47
|
-
|
48
|
-
|
49
|
-
dsl.remote_repositories.should eql( ["http://repository.jboss.org/nexus/content/groups/public-jboss", 'http://new-repo'] )
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'lock_jar/domain/dsl_helper'
|
4
|
+
|
5
|
+
describe LockJar::Domain::DslHelper do
|
6
|
+
|
7
|
+
it "should merge dsl" do
|
8
|
+
block1 = LockJar::Domain::Dsl.create do
|
9
|
+
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
10
|
+
|
11
|
+
jar "org.apache.mina:mina-core:2.0.4"
|
12
|
+
pom 'spec/pom.xml'
|
13
|
+
|
14
|
+
group 'runtime' do
|
15
|
+
jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
|
16
|
+
end
|
17
|
+
|
18
|
+
group 'test' do
|
19
|
+
jar 'junit:junit:jar:4.10'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
block2 = LockJar::Domain::Dsl.create do
|
24
|
+
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
25
|
+
repository 'http://new-repo'
|
26
|
+
|
27
|
+
jar "org.apache.mina:mina-core:2.0.4"
|
28
|
+
jar "compile-jar"
|
29
|
+
|
30
|
+
group 'runtime' do
|
31
|
+
jar 'runtime-jar'
|
32
|
+
pom 'runtime-pom.xml'
|
33
|
+
end
|
34
|
+
|
35
|
+
group 'test' do
|
36
|
+
jar 'test-jar'
|
37
|
+
pom 'test-pom.xml'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
dsl = LockJar::Domain::DslHelper.merge( block1, block2 )
|
42
|
+
|
43
|
+
dsl.artifacts['default'].should =~ [LockJar::Domain::Jar.new("org.apache.mina:mina-core:2.0.4"), LockJar::Domain::Pom.new("spec/pom.xml",["runtime", "compile"]), LockJar::Domain::Jar.new("compile-jar")]
|
44
|
+
|
45
|
+
# "runtime" => [LockJar::Domain::Jar.new("org.apache.tomcat:servlet-api:jar:6.0.35"), LockJar::Domain::Jar.new("runtime-jar"), LockJar::Domain::Pom.new("runtime-pom.xml")],
|
46
|
+
# "test" => [LockJar::Domain::Jar.new("junit:junit:jar:4.10"), LockJar::Domain::Jar.new("test-jar"), LockJar::Domain::Pom.new("test-pom.xml")]
|
47
|
+
|
48
|
+
|
49
|
+
dsl.remote_repositories.should eql( ["http://repository.jboss.org/nexus/content/groups/public-jboss", 'http://new-repo'] )
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -1,57 +1,57 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'lock_jar/domain/artifact'
|
3
|
-
|
4
|
-
describe LockJar::Domain::Dsl do
|
5
|
-
context "Instance" do
|
6
|
-
it "should load a Jarfile" do
|
7
|
-
jarfile = LockJar::Domain::Dsl.create( "spec/fixtures/Jarfile" )
|
8
|
-
|
9
|
-
jarfile.local_repository.should eql '~/.m2/repository'
|
10
|
-
jarfile.artifacts["default"][0].should == LockJar::Domain::Jar.new("org.apache.mina:mina-core:2.0.4")
|
11
|
-
jarfile.artifacts["default"][1].should == LockJar::Domain::Local.new("spec/fixtures/naether-0.13.0.jar")
|
12
|
-
jarfile.artifacts["default"][2].path.should eql "spec/pom.xml"
|
13
|
-
jarfile.artifacts["default"][3].should be_nil
|
14
|
-
|
15
|
-
jarfile.artifacts["development"][0].should == LockJar::Domain::Jar.new("com.typesafe:config:jar:0.5.0")
|
16
|
-
jarfile.artifacts["development"][1].should be_nil
|
17
|
-
|
18
|
-
jarfile.artifacts["test"][0].should == LockJar::Domain::Jar.new("junit:junit:jar:4.10")
|
19
|
-
jarfile.artifacts["test"][1].should be_nil
|
20
|
-
|
21
|
-
jarfile.remote_repositories.should eql( ['http://mirrors.ibiblio.org/pub/mirrors/maven2'] )
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should load a block" do
|
25
|
-
block = LockJar::Domain::Dsl.create do
|
26
|
-
local_repo '~/.m2'
|
27
|
-
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
28
|
-
|
29
|
-
jar "org.apache.mina:mina-core:2.0.4"
|
30
|
-
local "spec/fixtures/naether-0.13.0.jar"
|
31
|
-
pom 'spec/pom.xml'
|
32
|
-
|
33
|
-
group 'pirate' do
|
34
|
-
jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
|
35
|
-
end
|
36
|
-
|
37
|
-
group 'test' do
|
38
|
-
jar 'junit:junit:jar:4.10'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
block.local_repository.should eql '~/.m2'
|
43
|
-
block.artifacts.should == {
|
44
|
-
"default" => [LockJar::Domain::Jar.new("org.apache.mina:mina-core:2.0.4"), LockJar::Domain::Local.new("spec/fixtures/naether-0.13.0.jar"), LockJar::Domain::Pom.new("spec/pom.xml")],
|
45
|
-
"pirate" => [LockJar::Domain::Jar.new("org.apache.tomcat:servlet-api:jar:6.0.35")],
|
46
|
-
"test" => [LockJar::Domain::Jar.new("junit:junit:jar:4.10")]
|
47
|
-
}
|
48
|
-
block.remote_repositories.should eql( ["http://repository.jboss.org/nexus/content/groups/public-jboss"] )
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should raise an error without arguments" do
|
53
|
-
lambda { LockJar::Domain::Dsl.create }.should raise_error
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'lock_jar/domain/artifact'
|
3
|
+
|
4
|
+
describe LockJar::Domain::Dsl do
|
5
|
+
context "Instance" do
|
6
|
+
it "should load a Jarfile" do
|
7
|
+
jarfile = LockJar::Domain::Dsl.create( "spec/fixtures/Jarfile" )
|
8
|
+
|
9
|
+
jarfile.local_repository.should eql '~/.m2/repository'
|
10
|
+
jarfile.artifacts["default"][0].should == LockJar::Domain::Jar.new("org.apache.mina:mina-core:2.0.4")
|
11
|
+
jarfile.artifacts["default"][1].should == LockJar::Domain::Local.new("spec/fixtures/naether-0.13.0.jar")
|
12
|
+
jarfile.artifacts["default"][2].path.should eql "spec/pom.xml"
|
13
|
+
jarfile.artifacts["default"][3].should be_nil
|
14
|
+
|
15
|
+
jarfile.artifacts["development"][0].should == LockJar::Domain::Jar.new("com.typesafe:config:jar:0.5.0")
|
16
|
+
jarfile.artifacts["development"][1].should be_nil
|
17
|
+
|
18
|
+
jarfile.artifacts["test"][0].should == LockJar::Domain::Jar.new("junit:junit:jar:4.10")
|
19
|
+
jarfile.artifacts["test"][1].should be_nil
|
20
|
+
|
21
|
+
jarfile.remote_repositories.should eql( ['http://mirrors.ibiblio.org/pub/mirrors/maven2'] )
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should load a block" do
|
25
|
+
block = LockJar::Domain::Dsl.create do
|
26
|
+
local_repo '~/.m2'
|
27
|
+
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
28
|
+
|
29
|
+
jar "org.apache.mina:mina-core:2.0.4"
|
30
|
+
local "spec/fixtures/naether-0.13.0.jar"
|
31
|
+
pom 'spec/pom.xml'
|
32
|
+
|
33
|
+
group 'pirate' do
|
34
|
+
jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
|
35
|
+
end
|
36
|
+
|
37
|
+
group 'test' do
|
38
|
+
jar 'junit:junit:jar:4.10'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
block.local_repository.should eql '~/.m2'
|
43
|
+
block.artifacts.should == {
|
44
|
+
"default" => [LockJar::Domain::Jar.new("org.apache.mina:mina-core:2.0.4"), LockJar::Domain::Local.new("spec/fixtures/naether-0.13.0.jar"), LockJar::Domain::Pom.new("spec/pom.xml")],
|
45
|
+
"pirate" => [LockJar::Domain::Jar.new("org.apache.tomcat:servlet-api:jar:6.0.35")],
|
46
|
+
"test" => [LockJar::Domain::Jar.new("junit:junit:jar:4.10")]
|
47
|
+
}
|
48
|
+
block.remote_repositories.should eql( ["http://repository.jboss.org/nexus/content/groups/public-jboss"] )
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should raise an error without arguments" do
|
53
|
+
lambda { LockJar::Domain::Dsl.create }.should raise_error
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
data/spec/lock_jar/maven_spec.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'lock_jar'
|
3
|
-
require 'lock_jar/maven'
|
4
|
-
require 'naether'
|
5
|
-
|
6
|
-
describe LockJar::Maven do
|
7
|
-
before do
|
8
|
-
# Bootstrap Naether
|
9
|
-
Naether::Bootstrap.bootstrap_local_repo
|
10
|
-
end
|
11
|
-
|
12
|
-
context "Class" do
|
13
|
-
it "should get pom version" do
|
14
|
-
LockJar::Maven.pom_version( "spec/pom.xml" ).should eql( "3" )
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should install artifact" do
|
18
|
-
LockJar::Maven.install( "maven_spec:install:7", "spec/pom.xml", nil, :local_repo => "#{TEMP_DIR}/test-repo" )
|
19
|
-
|
20
|
-
File.exists?( "#{TEMP_DIR}/test-repo/maven_spec/install/7/install-7.pom" ).should be_true
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'lock_jar'
|
3
|
+
require 'lock_jar/maven'
|
4
|
+
require 'naether'
|
5
|
+
|
6
|
+
describe LockJar::Maven do
|
7
|
+
before do
|
8
|
+
# Bootstrap Naether
|
9
|
+
Naether::Bootstrap.bootstrap_local_repo
|
10
|
+
end
|
11
|
+
|
12
|
+
context "Class" do
|
13
|
+
it "should get pom version" do
|
14
|
+
LockJar::Maven.pom_version( "spec/pom.xml" ).should eql( "3" )
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should install artifact" do
|
18
|
+
LockJar::Maven.install( "maven_spec:install:7", "spec/pom.xml", nil, :local_repo => "#{TEMP_DIR}/test-repo" )
|
19
|
+
|
20
|
+
File.exists?( "#{TEMP_DIR}/test-repo/maven_spec/install/7/install-7.pom" ).should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'lock_jar/resolver'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'naether'
|
5
|
-
|
6
|
-
describe LockJar::Resolver do
|
7
|
-
context "Instance" do
|
8
|
-
before(:each) do
|
9
|
-
FileUtils.mkdir_p( "#{TEMP_DIR}/test-repo" )
|
10
|
-
@resolver = LockJar::Resolver.new( :local_repo => "#{TEMP_DIR}/test-repo" )
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should bootstrap naether" do
|
14
|
-
deps = Naether::Bootstrap.check_local_repo_for_deps( "#{TEMP_DIR}/test-repo" )
|
15
|
-
deps[:missing].should eql([])
|
16
|
-
deps[:exists].each do |dep|
|
17
|
-
dep.values[0].should match /#{TEMP_DIR}#{File::SEPARATOR}test-repo#{File::SEPARATOR}.+/
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return local paths for notations" do
|
22
|
-
@resolver.to_local_paths( ["junit:junit:jar:4.10"] ).should
|
23
|
-
eql( [File.expand_path("#{TEMP_DIR}/test-repo/junit/junit/4.10/junit-4.10.jar")] )
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'lock_jar/resolver'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'naether'
|
5
|
+
|
6
|
+
describe LockJar::Resolver do
|
7
|
+
context "Instance" do
|
8
|
+
before(:each) do
|
9
|
+
FileUtils.mkdir_p( "#{TEMP_DIR}/test-repo" )
|
10
|
+
@resolver = LockJar::Resolver.new( :local_repo => "#{TEMP_DIR}/test-repo" )
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should bootstrap naether" do
|
14
|
+
deps = Naether::Bootstrap.check_local_repo_for_deps( "#{TEMP_DIR}/test-repo" )
|
15
|
+
deps[:missing].should eql([])
|
16
|
+
deps[:exists].each do |dep|
|
17
|
+
dep.values[0].should match /#{TEMP_DIR}#{File::SEPARATOR}test-repo#{File::SEPARATOR}.+/
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return local paths for notations" do
|
22
|
+
@resolver.to_local_paths( ["junit:junit:jar:4.10"] ).should
|
23
|
+
eql( [File.expand_path("#{TEMP_DIR}/test-repo/junit/junit/4.10/junit-4.10.jar")] )
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'lock_jar/runtime'
|
3
|
-
|
4
|
-
describe LockJar::Runtime do
|
5
|
-
context "Singleton" do
|
6
|
-
it "should set local repo" do
|
7
|
-
LockJar::Runtime.instance.load( nil, [], :resolve => true, :local_repo => TEST_REPO ) do
|
8
|
-
jar 'junit:junit:4.10'
|
9
|
-
end
|
10
|
-
|
11
|
-
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql TEST_REPO
|
12
|
-
|
13
|
-
LockJar::Runtime.instance.load( nil, [], :local_repo => PARAM_CONFIG ) do
|
14
|
-
local_repo 'dsl_config'
|
15
|
-
end
|
16
|
-
|
17
|
-
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql PARAM_CONFIG
|
18
|
-
|
19
|
-
LockJar::Runtime.instance.load( nil ) do
|
20
|
-
local_repo DSL_CONFIG
|
21
|
-
end
|
22
|
-
|
23
|
-
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql DSL_CONFIG
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'lock_jar/runtime'
|
3
|
+
|
4
|
+
describe LockJar::Runtime do
|
5
|
+
context "Singleton" do
|
6
|
+
it "should set local repo" do
|
7
|
+
LockJar::Runtime.instance.load( nil, [], :resolve => true, :local_repo => TEST_REPO ) do
|
8
|
+
jar 'junit:junit:4.10'
|
9
|
+
end
|
10
|
+
|
11
|
+
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql TEST_REPO
|
12
|
+
|
13
|
+
LockJar::Runtime.instance.load( nil, [], :local_repo => PARAM_CONFIG ) do
|
14
|
+
local_repo 'dsl_config'
|
15
|
+
end
|
16
|
+
|
17
|
+
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql PARAM_CONFIG
|
18
|
+
|
19
|
+
LockJar::Runtime.instance.load( nil ) do
|
20
|
+
local_repo DSL_CONFIG
|
21
|
+
end
|
22
|
+
|
23
|
+
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql DSL_CONFIG
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|