jbundler 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +2 -2
- data/lib/commands/abstract_command.rb~ +113 -0
- data/lib/commands/install_with_jars.rb~ +22 -0
- data/lib/commands/nexus.rb~ +38 -0
- data/lib/commands/push.rb~ +38 -0
- data/lib/jars.rb~ +3 -0
- data/lib/jbundler/aether.rb +2 -2
- data/lib/jbundler.jar +0 -0
- data/lib/rubygems_plugin.rb~ +6 -0
- metadata +8 -22
- data/Test.md +0 -0
- data/lib/jbundler/aether.rb~ +0 -68
- data/lib/jbundler/classpath_file.rb~ +0 -207
- data/lib/jbundler/cli.rb~ +0 -5
- data/lib/jbundler/config.rb~ +0 -145
- data/lib/jbundler/gemfile_lock.rb~ +0 -17
- data/lib/jbundler/lazy.rb~ +0 -24
- data/lib/jbundler/maven.rb~ +0 -252
- data/lib/jbundler/maven_gemify3.rb~ +0 -337
- data/lib/jbundler/maven_util.rb~ +0 -46
- data/lib/jbundler/maven_version.rb~ +0 -4
- data/lib/jbundler/mavenfile.rb~ +0 -9
- data/lib/jbundler/pom.rb~ +0 -251
- data/lib/jbundler.rb~ +0 -2
- data/spec/aether_spec.rb~ +0 -101
- data/spec/classpath_file_spec.rb~ +0 -81
- data/spec/maven_util_spec.rb~ +0 -33
- data/spec/mavenfile_spec.rb~ +0 -40
- data/spec/pom_spec.rb~ +0 -40
- data/spec/setup.rb~ +0 -3
data/spec/aether_spec.rb~
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'maven/tools/jarfile'
|
2
|
-
require 'jbundler/aether'
|
3
|
-
|
4
|
-
describe Maven::Tools::Jarfile do
|
5
|
-
|
6
|
-
let(:workdir) { 'target' }
|
7
|
-
let(:jfile) { File.join(workdir, 'tmp-jarfile') }
|
8
|
-
let(:jfile_lock) { jfile + ".lock"}
|
9
|
-
let(:aether) { JBundler::AetherRuby.new }
|
10
|
-
subject { Maven::Tools::Jarfile.new(jfile) }
|
11
|
-
|
12
|
-
before do
|
13
|
-
Dir[File.join(workdir, "tmp*")].each { |f| FileUtils.rm_f f }
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'generates lockfile' do
|
17
|
-
subject.generate_lockfile(%w( a b c d e f))
|
18
|
-
File.read(jfile_lock).must_equal <<-EOF
|
19
|
-
a
|
20
|
-
b
|
21
|
-
c
|
22
|
-
d
|
23
|
-
e
|
24
|
-
f
|
25
|
-
EOF
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'check locked coordinate' do
|
29
|
-
File.open(jfile_lock, 'w') do |f|
|
30
|
-
f.write <<-EOF
|
31
|
-
a:b:pom:3
|
32
|
-
a:c:jar:1
|
33
|
-
EOF
|
34
|
-
end
|
35
|
-
subject.locked.must_equal ["a:b:pom:3", "a:c:jar:1"]
|
36
|
-
subject.locked?("a:b:pom:321").must_equal true
|
37
|
-
subject.locked?("a:b:jar:321").must_equal true
|
38
|
-
subject.locked?("a:d:jar:432").must_equal false
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'populate repositories' do
|
42
|
-
File.open(jfile, 'w') do |f|
|
43
|
-
f.write <<-EOF
|
44
|
-
repository :first, "http://example.com/repo"
|
45
|
-
source 'second', "http://example.org/repo"
|
46
|
-
EOF
|
47
|
-
end
|
48
|
-
subject.populate_unlocked aether
|
49
|
-
aether.repositories.size.must_equal 3
|
50
|
-
aether.artifacts.size.must_equal 0
|
51
|
-
aether.repositories[0].id.must_equal "central"
|
52
|
-
aether.repositories[1].id.must_equal "first"
|
53
|
-
aether.repositories[2].id.must_equal "second"
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'populate artifacts without locked' do
|
57
|
-
File.open(jfile, 'w') do |f|
|
58
|
-
f.write <<-EOF
|
59
|
-
jar 'a:b', '123'
|
60
|
-
pom 'x:y', '987'
|
61
|
-
EOF
|
62
|
-
end
|
63
|
-
subject.populate_unlocked aether
|
64
|
-
aether.repositories.size.must_equal 1 # central
|
65
|
-
aether.artifacts.size.must_equal 2
|
66
|
-
aether.artifacts[0].to_s.must_equal "a:b:jar:123"
|
67
|
-
aether.artifacts[1].to_s.must_equal "x:y:pom:987"
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'populate artifacts with locked' do
|
71
|
-
File.open(jfile, 'w') do |f|
|
72
|
-
f.write <<-EOF
|
73
|
-
jar 'a:b', '123'
|
74
|
-
pom 'x:y', '987'
|
75
|
-
EOF
|
76
|
-
end
|
77
|
-
File.open(jfile_lock, 'w') do |f|
|
78
|
-
f.write <<-EOF
|
79
|
-
a:b:jar:432
|
80
|
-
EOF
|
81
|
-
end
|
82
|
-
|
83
|
-
subject.populate_unlocked aether
|
84
|
-
aether.repositories.size.must_equal 1 # central
|
85
|
-
aether.artifacts.size.must_equal 1
|
86
|
-
aether.artifacts[0].to_s.must_equal "x:y:pom:987"
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'populate locked artifacts' do
|
90
|
-
File.open(jfile_lock, 'w') do |f|
|
91
|
-
f.write <<-EOF
|
92
|
-
a:b:jar:432
|
93
|
-
EOF
|
94
|
-
end
|
95
|
-
|
96
|
-
subject.populate_locked aether
|
97
|
-
aether.repositories.size.must_equal 1 # central
|
98
|
-
aether.artifacts.size.must_equal 1
|
99
|
-
aether.artifacts[0].to_s.must_equal "a:b:jar:432"
|
100
|
-
end
|
101
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'jbundler/classpath_file'
|
2
|
-
require 'jbundler/mavenfile'
|
3
|
-
require 'jbundler/gemfile_lock'
|
4
|
-
|
5
|
-
describe JBundler::ClasspathFile do
|
6
|
-
|
7
|
-
let(:workdir) { 'target' }
|
8
|
-
let(:mfile) { File.join(workdir, 'tmp-mvnfile') }
|
9
|
-
let(:gfile_lock) { File.join(workdir, 'tmp-gemfile.lock') }
|
10
|
-
let(:mfile_lock) { mfile + ".lock"}
|
11
|
-
let(:cpfile) { File.join(workdir, 'tmp-cp.rb') }
|
12
|
-
let(:mavenfile) { JBundler::Mavenfile.new(mfile) }
|
13
|
-
let(:gemfile_lock) { JBundler::GemfileLock.new(gfile_lock) }
|
14
|
-
subject { JBundler::ClasspathFile.new(cpfile) }
|
15
|
-
|
16
|
-
before do
|
17
|
-
Dir[File.join(workdir, "tmp*")].each { |f| FileUtils.rm_f f }
|
18
|
-
FileUtils.touch gfile_lock #assume there is always a Gemfile.lock
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'needs update when all files are missing' do
|
22
|
-
subject.needs_update?(mavenfile,gemfile_lock).must_equal true
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'needs update when only mavenfile' do
|
26
|
-
FileUtils.touch mfile
|
27
|
-
subject.needs_update?(mavenfile,gemfile_lock).must_equal true
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'needs update when mavenfilelock is missing' do
|
31
|
-
FileUtils.touch mfile
|
32
|
-
FileUtils.touch cpfile
|
33
|
-
subject.needs_update?(mavenfile,gemfile_lock).must_equal true
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'needs no update when classpath file is the youngest' do
|
37
|
-
FileUtils.touch mfile
|
38
|
-
FileUtils.touch mfile_lock
|
39
|
-
FileUtils.touch cpfile
|
40
|
-
subject.needs_update?(mavenfile,gemfile_lock).must_equal false
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'needs update when maven file is the youngest' do
|
44
|
-
FileUtils.touch mfile_lock
|
45
|
-
FileUtils.touch cpfile
|
46
|
-
sleep 1
|
47
|
-
FileUtils.touch mfile
|
48
|
-
subject.needs_update?(mavenfile,gemfile_lock).must_equal true
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'needs update when maven lockfile is the youngest' do
|
52
|
-
FileUtils.touch mfile
|
53
|
-
FileUtils.touch cpfile
|
54
|
-
sleep 1
|
55
|
-
FileUtils.touch mfile_lock
|
56
|
-
subject.needs_update?(mavenfile,gemfile_lock).must_equal true
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'needs update when gem lockfile is the youngest' do
|
60
|
-
FileUtils.touch mfile
|
61
|
-
FileUtils.touch cpfile
|
62
|
-
FileUtils.touch mfile_lock
|
63
|
-
sleep 1
|
64
|
-
FileUtils.touch gfile_lock
|
65
|
-
subject.needs_update?(mavenfile,gemfile_lock).must_equal true
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'generates a classpath ruby file' do
|
69
|
-
subject.generate("a:b:c:d:f:".gsub(/:/, File::PATH_SEPARATOR))
|
70
|
-
File.read(cpfile).must_equal <<-EOF
|
71
|
-
JBUNDLER_CLASSPATH = []
|
72
|
-
JBUNDLER_CLASSPATH << 'a'
|
73
|
-
JBUNDLER_CLASSPATH << 'b'
|
74
|
-
JBUNDLER_CLASSPATH << 'c'
|
75
|
-
JBUNDLER_CLASSPATH << 'd'
|
76
|
-
JBUNDLER_CLASSPATH << 'f'
|
77
|
-
JBUNDLER_CLASSPATH.freeze
|
78
|
-
JBUNDLER_CLASSPATH.each { |c| require c }
|
79
|
-
EOF
|
80
|
-
end
|
81
|
-
end
|
data/spec/maven_util_spec.rb~
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'jbundler/maven_util'
|
2
|
-
class A
|
3
|
-
include JBundler::MavenUtil
|
4
|
-
end
|
5
|
-
|
6
|
-
describe JBundler::MavenUtil do
|
7
|
-
|
8
|
-
subject { A.new }
|
9
|
-
|
10
|
-
it 'should convert ruby version to maven version ranges' do
|
11
|
-
subject.to_version.must_equal "[0,)"
|
12
|
-
subject.to_version('!2.3.4').must_equal "(2.3.4,)"
|
13
|
-
subject.to_version('=2.3.4').must_equal "[2.3.4,2.3.4.0.0.0.0.1)"
|
14
|
-
subject.to_version('~>1.8.2').must_equal "[1.8.2,1.8.99999]"
|
15
|
-
subject.to_version('~>1.8').must_equal "[1.8,1.99999]"
|
16
|
-
subject.to_version('>1.2').must_equal "(1.2,)"
|
17
|
-
subject.to_version('<1.2').must_equal "[0,1.2)"
|
18
|
-
subject.to_version('>=1.2').must_equal "[1.2,)"
|
19
|
-
subject.to_version('<=1.2').must_equal "[0,1.2]"
|
20
|
-
subject.to_version('>=1.2', '<2.0').must_equal "[1.2,2.0)"
|
21
|
-
subject.to_version('>=1.2', '<=2.0').must_equal "[1.2,2.0]"
|
22
|
-
subject.to_version('>1.2', '<2.0').must_equal "(1.2,2.0)"
|
23
|
-
subject.to_version('>1.2', '<=2.0').must_equal "(1.2,2.0]"
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should maven version and ranges as is' do
|
27
|
-
subject.to_version('1.2.3').must_equal "1.2.3"
|
28
|
-
subject.to_version('(1,2)').must_equal "(1,2)"
|
29
|
-
subject.to_version('[1,2)').must_equal "[1,2)"
|
30
|
-
subject.to_version('(1,2]').must_equal "(1,2]"
|
31
|
-
subject.to_version('[1,2]').must_equal "[1,2]"
|
32
|
-
end
|
33
|
-
end
|
data/spec/mavenfile_spec.rb~
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'jbundler/classpath_file'
|
2
|
-
require 'jbundler/mavenfile'
|
3
|
-
require 'jbundler/gemfile_lock'
|
4
|
-
|
5
|
-
describe JBundler::Mavenfile do
|
6
|
-
|
7
|
-
let(:workdir) { 'target' }
|
8
|
-
let(:mfile) { File.join(workdir, 'tmp-mvnfile') }
|
9
|
-
let(:mfile_lock) { mfile + ".lock"}
|
10
|
-
subject { JBundler::Mavenfile.new(mfile) }
|
11
|
-
|
12
|
-
before do
|
13
|
-
Dir[File.join(workdir, "tmp*")].each { |f| FileUtils.rm_f f }
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'generates lockfile' do
|
17
|
-
subject.generate_lockfile(%w( a b c d e f))
|
18
|
-
File.read(mfile_lock).must_equal <<-EOF
|
19
|
-
a
|
20
|
-
b
|
21
|
-
c
|
22
|
-
d
|
23
|
-
e
|
24
|
-
f
|
25
|
-
EOF
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'check locked coordinate' do
|
29
|
-
File.open(mfile_lock, 'w') do |f|
|
30
|
-
f.write <<-EOF
|
31
|
-
a:b:pom:3
|
32
|
-
a:c:jar:1
|
33
|
-
EOF
|
34
|
-
end
|
35
|
-
subject.locked.must_equal ["a:b:pom:3", "a:c:jar:1"]
|
36
|
-
subject.locked?("a:b:pom:321").must_equal true
|
37
|
-
subject.locked?("a:b:jar:321").must_equal true
|
38
|
-
subject.locked?("a:d:jar:432").must_equal false
|
39
|
-
end
|
40
|
-
end
|
data/spec/pom_spec.rb~
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'jbundler/classpath_file'
|
2
|
-
require 'jbundler/mavenfile'
|
3
|
-
require 'jbundler/gemfile_lock'
|
4
|
-
|
5
|
-
describe JBundler::Mavenfile do
|
6
|
-
|
7
|
-
let(:workdir) { 'target' }
|
8
|
-
let(:mfile) { File.join(workdir, 'tmp-mvnfile') }
|
9
|
-
let(:mfile_lock) { mfile + ".lock"}
|
10
|
-
subject { JBundler::Mavenfile.new(mfile) }
|
11
|
-
|
12
|
-
before do
|
13
|
-
Dir[File.join(workdir, "tmp*")].each { |f| FileUtils.rm_f f }
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'generates lockfile' do
|
17
|
-
subject.generate_lockfile(%w( a b c d e f))
|
18
|
-
File.read(mfile_lock).must_equal <<-EOF
|
19
|
-
a
|
20
|
-
b
|
21
|
-
c
|
22
|
-
d
|
23
|
-
e
|
24
|
-
f
|
25
|
-
EOF
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'check locked coordinate' do
|
29
|
-
File.open(mfile_lock, 'w') do |f|
|
30
|
-
f.write <<-EOF
|
31
|
-
a:b:3
|
32
|
-
a:c:1
|
33
|
-
EOF
|
34
|
-
end
|
35
|
-
subject.load_lockfile.must_equal ["a:b:3", "a:c:1"]
|
36
|
-
subject.locked.must_equal ["a:b:3", "a:c:1"]
|
37
|
-
subject.locked?("a:b:321").must_equal true
|
38
|
-
subject.locked?("a:d:432").must_equal false
|
39
|
-
end
|
40
|
-
end
|
data/spec/setup.rb~
DELETED