jbundler 0.7.4 → 0.8.0.pre
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/Gemfile.lock~ +46 -0
- data/Readme.md +15 -103
- data/bin/jbundle +41 -60
- data/lib/jbundler/executor.rb +107 -0
- data/lib/jbundler/pom.rb +27 -145
- data/lib/jbundler.rb +5 -47
- metadata +29 -74
- data/lib/jbundler/aether.rb +0 -139
- data/lib/jbundler/classpath_file.rb +0 -115
- data/lib/jbundler/cli.rb +0 -171
- data/lib/jbundler/config.rb +0 -191
- data/lib/jbundler/configurator.rb +0 -27
- data/lib/jbundler/context.rb +0 -34
- data/lib/jbundler/dependency_pom.rb +0 -29
- data/lib/jbundler/executable.rb +0 -41
- data/lib/jbundler/executable_pom.rb +0 -105
- data/lib/jbundler/gemfile_lock.rb +0 -69
- data/lib/jbundler/jarfile_lock.rb +0 -67
- data/lib/jbundler/jruby_complete.rb +0 -44
- data/lib/jbundler/jruby_complete_pom.rb +0 -31
- data/lib/jbundler/lazy.rb +0 -102
- data/lib/jbundler/lock_down.rb +0 -166
- data/lib/jbundler/pom_runner.rb +0 -71
- data/lib/jbundler/show.rb +0 -53
- data/lib/jbundler/tree.rb +0 -31
- data/lib/jbundler/vendor.rb +0 -52
- data/lib/jbundler.jar +0 -0
- data/spec/aether_spec.rb +0 -98
- data/spec/classpath_file_spec.rb +0 -138
- data/spec/config_spec.rb +0 -180
- data/spec/pom_spec.rb +0 -30
- data/spec/project/Settings.xml +0 -0
- data/spec/project/settings.xml +0 -0
- data/spec/setup.rb +0 -16
- data/spec/vendor_spec.rb +0 -60
data/spec/classpath_file_spec.rb
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
load File.expand_path(File.join('spec', 'setup.rb'))
|
2
|
-
require 'jbundler/classpath_file'
|
3
|
-
require 'maven/tools/jarfile'
|
4
|
-
require 'jbundler/gemfile_lock'
|
5
|
-
|
6
|
-
describe JBundler::ClasspathFile do
|
7
|
-
|
8
|
-
let(:workdir) { File.join('pkg', 'tmp') }
|
9
|
-
let(:jfile) { File.join(workdir, 'jarfile') }
|
10
|
-
let(:gfile_lock) { File.join(workdir, 'gemfile.lock') }
|
11
|
-
let(:jfile_lock) { jfile + ".lock"}
|
12
|
-
let(:cpfile) { File.join(workdir, 'cp.rb') }
|
13
|
-
let(:jarfile) { Maven::Tools::Jarfile.new(jfile) }
|
14
|
-
let(:gemfile_lock) { JBundler::GemfileLock.new(jarfile, gfile_lock) }
|
15
|
-
subject { JBundler::ClasspathFile.new(cpfile) }
|
16
|
-
|
17
|
-
before do
|
18
|
-
FileUtils.mkdir_p(workdir)
|
19
|
-
Dir[File.join(workdir, '*')].each { |f| FileUtils.rm_f f }
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'needs no update when all files are missing' do
|
23
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal false
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'needs update when only gemfile' do
|
27
|
-
FileUtils.touch gfile_lock
|
28
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal true
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'needs update when only jarfile' do
|
32
|
-
FileUtils.touch jfile
|
33
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal true
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'needs update when jarfilelock is missing' do
|
37
|
-
FileUtils.touch gfile_lock
|
38
|
-
FileUtils.touch jfile
|
39
|
-
FileUtils.touch cpfile
|
40
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal true
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'needs no update when classpath file is the youngest' do
|
44
|
-
FileUtils.touch jfile
|
45
|
-
FileUtils.touch jfile_lock
|
46
|
-
FileUtils.touch cpfile
|
47
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal false
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'needs update when jar file is the youngest' do
|
51
|
-
FileUtils.touch gfile_lock
|
52
|
-
FileUtils.touch jfile_lock
|
53
|
-
FileUtils.touch cpfile
|
54
|
-
sleep 1
|
55
|
-
FileUtils.touch jfile
|
56
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal true
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'needs update when jar lockfile is the youngest' do
|
60
|
-
FileUtils.touch gfile_lock
|
61
|
-
FileUtils.touch jfile
|
62
|
-
FileUtils.touch cpfile
|
63
|
-
sleep 1
|
64
|
-
FileUtils.touch jfile_lock
|
65
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal true
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'needs update when gem lockfile is the youngest' do
|
69
|
-
FileUtils.touch jfile
|
70
|
-
FileUtils.touch cpfile
|
71
|
-
FileUtils.touch jfile_lock
|
72
|
-
sleep 1
|
73
|
-
FileUtils.touch gfile_lock
|
74
|
-
subject.needs_update?(jarfile, gemfile_lock).must_equal true
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'generates a classpath ruby file without localrepo' do
|
78
|
-
subject.generate("a:b:c:d:f:".split(File::PATH_SEPARATOR) )
|
79
|
-
File.read(cpfile).must_equal <<-EOF
|
80
|
-
JBUNDLER_JRUBY_CLASSPATH = []
|
81
|
-
JBUNDLER_JRUBY_CLASSPATH.freeze
|
82
|
-
JBUNDLER_TEST_CLASSPATH = []
|
83
|
-
JBUNDLER_TEST_CLASSPATH.freeze
|
84
|
-
JBUNDLER_CLASSPATH = []
|
85
|
-
JBUNDLER_CLASSPATH << 'a'
|
86
|
-
JBUNDLER_CLASSPATH << 'b'
|
87
|
-
JBUNDLER_CLASSPATH << 'c'
|
88
|
-
JBUNDLER_CLASSPATH << 'd'
|
89
|
-
JBUNDLER_CLASSPATH << 'f'
|
90
|
-
JBUNDLER_CLASSPATH.freeze
|
91
|
-
EOF
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'generates a classpath ruby file with localrepo' do
|
95
|
-
subject.generate("a:b:c:d:f:".split(File::PATH_SEPARATOR), [], [], '/tmp')
|
96
|
-
File.read(cpfile).must_equal <<-EOF
|
97
|
-
require 'jar_dependencies'
|
98
|
-
JBUNDLER_LOCAL_REPO = Jars.home
|
99
|
-
JBUNDLER_JRUBY_CLASSPATH = []
|
100
|
-
JBUNDLER_JRUBY_CLASSPATH.freeze
|
101
|
-
JBUNDLER_TEST_CLASSPATH = []
|
102
|
-
JBUNDLER_TEST_CLASSPATH.freeze
|
103
|
-
JBUNDLER_CLASSPATH = []
|
104
|
-
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + 'a')
|
105
|
-
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + 'b')
|
106
|
-
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + 'c')
|
107
|
-
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + 'd')
|
108
|
-
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + 'f')
|
109
|
-
JBUNDLER_CLASSPATH.freeze
|
110
|
-
EOF
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'require classpath using default with generated localrepo' do
|
114
|
-
ENV[ 'JARS_HOME' ] = '/tmp'
|
115
|
-
Jars.reset
|
116
|
-
subject.generate("/a:/b:/c:/d:/f:".split(File::PATH_SEPARATOR), [], [], '/tmp')
|
117
|
-
begin
|
118
|
-
subject.require_classpath
|
119
|
-
rescue LoadError
|
120
|
-
# there are no files to require
|
121
|
-
end
|
122
|
-
JBUNDLER_CLASSPATH.must_equal ["/tmp/a", "/tmp/b", "/tmp/c", "/tmp/d", "/tmp/f"]
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'require classpath with generated localrepo' do
|
126
|
-
ENV[ 'JARS_HOME' ] = '/tmp'
|
127
|
-
subject.generate("/a:/b:/c:/d:/f:".split(File::PATH_SEPARATOR), [], [], '/tmp')
|
128
|
-
|
129
|
-
begin
|
130
|
-
Jars.reset
|
131
|
-
ENV[ 'JARS_HOME' ] = '/temp'
|
132
|
-
subject.require_classpath
|
133
|
-
rescue LoadError
|
134
|
-
# there are no files to require
|
135
|
-
end
|
136
|
-
JBUNDLER_CLASSPATH.must_equal ["/temp/a", "/temp/b", "/temp/c", "/temp/d", "/temp/f"]
|
137
|
-
end
|
138
|
-
end
|
data/spec/config_spec.rb
DELETED
@@ -1,180 +0,0 @@
|
|
1
|
-
load File.expand_path(File.join('spec', 'setup.rb'))
|
2
|
-
require 'jbundler/config'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
describe JBundler::Config do
|
6
|
-
|
7
|
-
let( :basedir ){ File.dirname( File.dirname( File.expand_path( __FILE__ ) ) ) }
|
8
|
-
let( :spec ){ 'spec' }
|
9
|
-
let( :spec_dir ){ File.join( basedir, spec ) }
|
10
|
-
let( :project ){ File.join( spec, 'project' ) }
|
11
|
-
let( :project_dir ) { File.join( basedir, project ) }
|
12
|
-
|
13
|
-
before do
|
14
|
-
# in case we have relative path __FILE__
|
15
|
-
basedir
|
16
|
-
Jars.reset
|
17
|
-
ENV.keys.each do |k|
|
18
|
-
ENV.delete( k ) if k.to_s.match /^(J?)BUNDLE/
|
19
|
-
ENV.delete( k ) if k.to_s.match /^JARS/
|
20
|
-
end
|
21
|
-
if defined? JRUBY_VERSION
|
22
|
-
java.lang.System.properties.keys.each do |k|
|
23
|
-
java.lang.System.properties.delete( k ) if k.to_s.match /^(j?)bundle/
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'has following defaults without home and without local config' do
|
29
|
-
ENV['HOME'] = '.'
|
30
|
-
|
31
|
-
FileUtils.cd( 'spec' ) do
|
32
|
-
c = JBundler::Config.new
|
33
|
-
c.verbose.must_equal nil
|
34
|
-
c.local_repository.must_equal './.m2/repository'
|
35
|
-
c.jarfile.must_equal File.join( basedir, 'Jarfile' )
|
36
|
-
c.gemfile.must_equal File.join( basedir, 'Gemfile' )
|
37
|
-
c.skip.must_equal nil
|
38
|
-
c.settings.must_equal "./.m2/settings.xml"
|
39
|
-
c.offline.must_equal false
|
40
|
-
c.work_dir.must_equal File.join( basedir, 'pkg' )
|
41
|
-
c.vendor_dir.must_equal File.join( basedir, 'vendor/jars' )
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'has following defaults without home and with local config' do
|
46
|
-
ENV['HOME'] = '.'
|
47
|
-
FileUtils.cd( project ) do
|
48
|
-
c = JBundler::Config.new
|
49
|
-
c.verbose.must_equal true
|
50
|
-
c.local_repository.must_equal File.join( project_dir, 'local' )
|
51
|
-
c.jarfile.must_equal File.join( project_dir, 'Jar_file' )
|
52
|
-
c.gemfile.must_equal File.join( project_dir, 'gemfile' )
|
53
|
-
c.skip.must_equal false
|
54
|
-
c.settings.must_equal File.join( project_dir, 'settings.xml' )
|
55
|
-
c.offline.must_equal true
|
56
|
-
c.work_dir.must_equal File.join( project_dir, 'pkg' )
|
57
|
-
c.vendor_dir.must_equal File.join( project_dir, 'vendor/myjars' )
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'has following defaults with home and without local config' do
|
62
|
-
ENV['HOME'] = File.join( 'home' )
|
63
|
-
|
64
|
-
FileUtils.cd( spec ) do
|
65
|
-
c = JBundler::Config.new
|
66
|
-
|
67
|
-
c.verbose.must_equal false
|
68
|
-
c.local_repository.must_equal File.join( spec_dir, 'localrepo' )
|
69
|
-
c.jarfile.must_equal File.join( spec_dir, 'jarfile' )
|
70
|
-
c.gemfile.must_equal File.join( spec_dir, 'Gem_file' )
|
71
|
-
c.skip.must_equal true
|
72
|
-
c.settings.must_equal File.join( spec_dir, 'Settings.xml' )
|
73
|
-
c.offline.must_equal false
|
74
|
-
c.work_dir.must_equal File.join( spec_dir, 'target/pkg' )
|
75
|
-
c.vendor_dir.must_equal File.join( spec_dir, 'vendor/my_jars' )
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'has following defaults with home and with local config' do
|
80
|
-
ENV['HOME'] = File.expand_path( File.join( 'spec', 'home' ) )
|
81
|
-
|
82
|
-
FileUtils.cd( project ) do
|
83
|
-
c = JBundler::Config.new
|
84
|
-
|
85
|
-
c.verbose.must_equal true
|
86
|
-
c.local_repository.must_equal File.join( project_dir, 'local' )
|
87
|
-
c.jarfile.must_equal File.join( project_dir, 'Jar_file' )
|
88
|
-
c.gemfile.must_equal File.join( project_dir, 'gemfile' )
|
89
|
-
c.skip.must_equal false
|
90
|
-
c.settings.must_equal File.join( project_dir, 'settings.xml' )
|
91
|
-
c.offline.must_equal true
|
92
|
-
c.work_dir.must_equal File.join( project_dir, 'pkg' )
|
93
|
-
c.vendor_dir.must_equal File.join( project_dir, 'vendor/myjars' )
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'has following defaults with local config starting from nested child directory' do
|
98
|
-
FileUtils.cd( File.join( project, 'some', 'more' ) ) do
|
99
|
-
c = JBundler::Config.new
|
100
|
-
|
101
|
-
c.verbose.must_equal true
|
102
|
-
c.local_repository.must_equal File.join( project_dir, 'local' )
|
103
|
-
c.jarfile.must_equal File.join( project_dir, 'Jar_file' )
|
104
|
-
c.gemfile.must_equal File.join( project_dir, 'gemfile' )
|
105
|
-
c.skip.must_equal false
|
106
|
-
c.settings.must_equal File.join( project_dir, 'settings.xml' )
|
107
|
-
c.offline.must_equal true
|
108
|
-
c.work_dir.must_equal File.join( project_dir, 'pkg' )
|
109
|
-
c.vendor_dir.must_equal File.join( project_dir, 'vendor/myjars' )
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe 'ENV and java.lang.System.properties' do
|
114
|
-
before do
|
115
|
-
ENV[ 'JBUNDLE_VERBOSE' ] = 'true'
|
116
|
-
ENV[ 'JBUNDLE_LOCAL_REPOSITORY' ] = 'local_repository'
|
117
|
-
ENV[ 'JBUNDLE_JARFILE' ] = 'JarFile'
|
118
|
-
ENV[ 'BUNDLE_GEMFILE' ] = 'GemFile'
|
119
|
-
ENV[ 'JBUNDLE_SETTINGS' ] = 'Settings.xml'
|
120
|
-
ENV[ 'JBUNDLE_SKIP' ] = 'false'
|
121
|
-
ENV[ 'JBUNDLE_OFFLINE' ] = 'true'
|
122
|
-
ENV[ 'JBUNDLE_WORK_DIR' ] = 'pkg/work'
|
123
|
-
ENV[ 'JBUNDLE_VENDOR_DIR' ] = 'vendor/localjars'
|
124
|
-
end
|
125
|
-
|
126
|
-
[ 'spec', 'spec/home' ].each do |home|
|
127
|
-
|
128
|
-
[ 'spec', 'spec/project' ].each do |dir|
|
129
|
-
|
130
|
-
it "uses ENV with home #{home} and local dir #{dir}" do
|
131
|
-
ENV['HOME'] = eval "\"#{File.expand_path( home )}\""
|
132
|
-
|
133
|
-
FileUtils.cd eval "\"#{dir}\"" do
|
134
|
-
pdir = eval "#{File.basename( dir )}_dir"
|
135
|
-
Jars.reset
|
136
|
-
c = JBundler::Config.new
|
137
|
-
c.verbose.must_equal true
|
138
|
-
c.local_repository.must_equal File.join( pdir, 'local_repository' )
|
139
|
-
c.jarfile.must_equal File.join( pdir, 'JarFile' )
|
140
|
-
c.gemfile.must_equal File.join( pdir, 'GemFile' )
|
141
|
-
c.skip.must_equal false
|
142
|
-
c.settings.must_equal File.join( pdir, 'Settings.xml' )
|
143
|
-
c.offline.must_equal true
|
144
|
-
c.work_dir.must_equal File.join( pdir, 'pkg/work' )
|
145
|
-
c.vendor_dir.must_equal File.join( pdir, 'vendor/localjars' )
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
it "uses java.lang.System.properties with home #{home} and local dir #{dir}" do
|
150
|
-
ENV['HOME'] = eval "\"#{File.expand_path( home )}\""
|
151
|
-
|
152
|
-
java.lang.System.set_property 'jbundle.verbose', 'false'
|
153
|
-
java.lang.System.set_property 'jbundle.local.repository', 'local_repo'
|
154
|
-
java.lang.System.set_property 'jbundle.jarfile', 'Jar_File'
|
155
|
-
java.lang.System.set_property 'bundle.gemfile', 'Gem_File'
|
156
|
-
java.lang.System.set_property 'jbundle.settings', 'settings.xml'
|
157
|
-
java.lang.System.set_property 'jbundle.skip', 'true'
|
158
|
-
java.lang.System.set_property 'jbundle.offline', 'false'
|
159
|
-
java.lang.System.set_property 'jbundle.work.dir', 'target/work'
|
160
|
-
java.lang.System.set_property 'jbundle.vendor.dir', 'vendor/local_jars'
|
161
|
-
|
162
|
-
FileUtils.cd eval "\"#{dir}\"" do
|
163
|
-
pdir = eval "#{File.basename( dir )}_dir"
|
164
|
-
c = JBundler::Config.new
|
165
|
-
c.verbose.must_equal false
|
166
|
-
c.local_repository.must_equal File.join( pdir, 'local_repo' )
|
167
|
-
c.jarfile.must_equal File.join( pdir, 'Jar_File' )
|
168
|
-
c.gemfile.must_equal File.join( pdir, 'Gem_File' )
|
169
|
-
c.skip.must_equal true
|
170
|
-
c.settings.must_equal File.join( pdir, 'settings.xml' )
|
171
|
-
c.offline.must_equal false
|
172
|
-
c.work_dir.must_equal File.join( pdir, 'target/work' )
|
173
|
-
c.vendor_dir.must_equal File.join( pdir, 'vendor/local_jars' )
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
data/spec/pom_spec.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
load File.expand_path(File.join('spec', 'setup.rb'))
|
2
|
-
require 'jbundler/pom'
|
3
|
-
|
4
|
-
describe JBundler::Pom do
|
5
|
-
|
6
|
-
it 'should create jar pom without deps' do
|
7
|
-
pom = JBundler::Pom.new("first", "1", [])
|
8
|
-
File.read(pom.file).must_equal "<?xml version=\"1.0\" ?><project><modelVersion>4.0.0</modelVersion><groupId>ruby.bundler</groupId><artifactId>first</artifactId><version>1</version><dependencies></dependencies></project>"
|
9
|
-
pom.coordinate.must_equal "ruby.bundler:first:jar:1"
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should create pom-pom without deps' do
|
13
|
-
pom = JBundler::Pom.new("first", "1", [], 'pom')
|
14
|
-
File.read(pom.file).must_equal "<?xml version=\"1.0\" ?><project><modelVersion>4.0.0</modelVersion><groupId>ruby.bundler</groupId><artifactId>first</artifactId><version>1</version><packaging>pom</packaging><dependencies></dependencies></project>"
|
15
|
-
pom.coordinate.must_equal "ruby.bundler:first:pom:1"
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should create jar pom without deps' do
|
19
|
-
pom = JBundler::Pom.new("second", "1", ["jar \"org.jruby:jruby-core\", '~>1.7.0'"])
|
20
|
-
File.read(pom.file).must_equal "<?xml version=\"1.0\" ?><project><modelVersion>4.0.0</modelVersion><groupId>ruby.bundler</groupId><artifactId>second</artifactId><version>1</version><dependencies><dependency><groupId>org.jruby</groupId><artifactId>jruby-core</artifactId><version>[1.7.0,1.7.99999]</version></dependency></dependencies></project>"
|
21
|
-
pom.coordinate.must_equal "ruby.bundler:second:jar:1"
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should respect classifiers' do
|
25
|
-
pom = JBundler::Pom.new("third", "1", ["jar \"org.jruby:jruby-core\", '~>1.7.0'", "pom \"f:g:jdk15\", \">1.2\", \"<=2.0\""])
|
26
|
-
File.read(pom.file).must_equal "<?xml version=\"1.0\" ?><project><modelVersion>4.0.0</modelVersion><groupId>ruby.bundler</groupId><artifactId>third</artifactId><version>1</version><dependencies><dependency><groupId>org.jruby</groupId><artifactId>jruby-core</artifactId><version>[1.7.0,1.7.99999]</version></dependency><dependency><groupId>f</groupId><artifactId>g</artifactId><version>(1.2,2.0]</version><type>pom</type><classifier>jdk15</classifier></dependency></dependencies></project>"
|
27
|
-
pom.coordinate.must_equal "ruby.bundler:third:jar:1"
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
data/spec/project/Settings.xml
DELETED
File without changes
|
data/spec/project/settings.xml
DELETED
File without changes
|
data/spec/setup.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# single spec setup
|
2
|
-
$LOAD_PATH.unshift File.join( File.dirname( File.expand_path( File.dirname( __FILE__ ) ) ),
|
3
|
-
'lib' )
|
4
|
-
|
5
|
-
# TODO somehow needed here for executable_spec
|
6
|
-
require 'maven/tools/coordinate'
|
7
|
-
|
8
|
-
begin
|
9
|
-
require 'minitest'
|
10
|
-
rescue LoadError
|
11
|
-
end
|
12
|
-
require 'minitest/autorun'
|
13
|
-
|
14
|
-
# supress warnings
|
15
|
-
require 'stringio'
|
16
|
-
$stderr = StringIO.new
|
data/spec/vendor_spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
load File.expand_path(File.join('spec', 'setup.rb'))
|
2
|
-
require 'jbundler/classpath_file'
|
3
|
-
require 'jbundler/vendor'
|
4
|
-
require 'maven/tools/jarfile'
|
5
|
-
require 'jbundler/gemfile_lock'
|
6
|
-
|
7
|
-
JBUNDLER_CLASSPATH = []
|
8
|
-
describe JBundler::Vendor do
|
9
|
-
|
10
|
-
let( :workdir ) { File.join('pkg', 'tmp') }
|
11
|
-
let( :vdir ) { File.join(workdir, 'jars') }
|
12
|
-
let( :jfile ) { File.join(workdir, 'jarfile') }
|
13
|
-
let( :gfile_lock ) { File.join(workdir, 'gemfile.lock') }
|
14
|
-
let( :jfile_lock ) { jfile + ".lock"}
|
15
|
-
let( :cpfile ) { File.join(workdir, 'cp.rb') }
|
16
|
-
let( :jarfile ) { Maven::Tools::Jarfile.new(jfile) }
|
17
|
-
let( :gemfile_lock ) { JBundler::GemfileLock.new(jarfile, gfile_lock) }
|
18
|
-
let( :cp ) { JBundler::ClasspathFile.new(cpfile) }
|
19
|
-
let( :jars ) { [ '1.jar', '2.jar' ] }
|
20
|
-
subject { JBundler::Vendor.new( vdir ) }
|
21
|
-
|
22
|
-
before do
|
23
|
-
FileUtils.mkdir_p(workdir)
|
24
|
-
Dir[File.join(workdir, '*')].each { |f| FileUtils.rm_f f }
|
25
|
-
FileUtils.rm_rf(vdir)
|
26
|
-
FileUtils.mkdir_p(vdir)
|
27
|
-
jars.each do |f|
|
28
|
-
FileUtils.touch( File.join( workdir, f ) )
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'is not vendored' do
|
33
|
-
subject.vendored?.must_equal false
|
34
|
-
subject.require_jars.must_equal true
|
35
|
-
FileUtils.rm_rf( vdir )
|
36
|
-
subject.vendored?.must_equal false
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should copy jars on setup and delete them on clear' do
|
40
|
-
::JBUNDLER_CLASSPATH = Dir[ File.join( workdir, "*.jar" )]
|
41
|
-
def cp.require_classpath
|
42
|
-
[ '1.jar', '2.jar' ]
|
43
|
-
end
|
44
|
-
|
45
|
-
subject.setup( cp )
|
46
|
-
|
47
|
-
j = Dir[ File.join( vdir, '*' ) ].collect do |f|
|
48
|
-
File.basename( f )
|
49
|
-
end
|
50
|
-
j.sort.must_equal jars.sort
|
51
|
-
|
52
|
-
subject.vendored?.must_equal true
|
53
|
-
|
54
|
-
subject.require_jars.must_equal true
|
55
|
-
|
56
|
-
subject.clear
|
57
|
-
Dir[ File.join( vdir, '*' ) ].must_equal []
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|