lock_jar 0.4.0 → 0.4.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/.gitignore +1 -0
- data/Gemfile +3 -1
- data/README.rdoc +15 -8
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/lockjar +39 -2
- data/lib/lock_jar/resolver.rb +6 -2
- data/lib/lock_jar/runtime.rb +10 -1
- data/lib/lock_jar.rb +46 -20
- data/lock_jar.gemspec +12 -8
- data/spec/Jarfile +1 -1
- data/spec/lock_jar/dsl_spec.rb +1 -1
- data/spec/lock_jar_spec.rb +32 -14
- metadata +38 -8
- data/lib/lock_jar/cli.rb +0 -21
- data/spec/lock_jar/cli_spec.rb +0 -17
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -53,8 +53,9 @@ Example Jarfile
|
|
53
53
|
* LockJar.lock( *args ): Using a Jarfile, creates a lock file. Depending on the type of arg, a different configuration is set.
|
54
54
|
* An arg of a String will set the Jarfile path, e.g. '/somewhere/Jarfile.different'. Default jarfile is *Jarfile*
|
55
55
|
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
56
|
-
*
|
57
|
-
*
|
56
|
+
* *:download* if true, will download jars to local repo. Defaults to true.
|
57
|
+
* *:local_repo* sets the local repo path
|
58
|
+
* *:lockfile* sets the Jarfile.lock path. Default lockfile is *Jarfile.lock*.
|
58
59
|
|
59
60
|
When the Jarfile is locked, the transitive dependencies are resolved and saved to the Jarfile.lock file.
|
60
61
|
|
@@ -108,16 +109,16 @@ The Jarfile.lock
|
|
108
109
|
* An arg of a String will set the Jarfile.lock path, e.g. 'Better.lock'. Default lock file is *Jarfile.lock*.
|
109
110
|
* An arg of an Array will set the scopes, e.g. ['compile','test']. Defaults scopes are *compile* and *runtime*.
|
110
111
|
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
111
|
-
*
|
112
|
-
*
|
113
|
-
*
|
112
|
+
* *:local_repo* sets the local repo path
|
113
|
+
* *:local_paths* converts the notations to paths of jars in the local repo
|
114
|
+
* *:resolve* to true will make transitive dependences resolve before returning list of jars
|
114
115
|
|
115
116
|
* LockJar.load(*args): Loads all dependencies to the classpath for scopes from the Jarfile.lock. Defaults scopes are *compile* and *runtime*. Default lock file is *Jarfile.lock*.
|
116
117
|
* An arg of a String will set the Jarfile.lock, e.g. 'Better.lock'
|
117
118
|
* An arg of an Array will set the scopes, e.g. ['compile','test']
|
118
119
|
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
119
|
-
*
|
120
|
-
*
|
120
|
+
* *:local_repo* sets the local repo path
|
121
|
+
* *:resolve* to true will make transitive dependences resolve before loading to classpath
|
121
122
|
|
122
123
|
Once a Jarfile.lock is generated, you can list all resolved jars by
|
123
124
|
|
@@ -164,9 +165,15 @@ There is a simple command line helper. You can lock a Jarfile with the following
|
|
164
165
|
|
165
166
|
lockjar lock
|
166
167
|
|
167
|
-
|
168
|
+
List jars in a Jarfile.lock with
|
168
169
|
|
169
170
|
lockjar list
|
171
|
+
|
172
|
+
Download all jars in a Jarfile.lock with
|
173
|
+
|
174
|
+
lockjar install
|
175
|
+
|
176
|
+
_lockjar_ _--help_ will give you list of all commands and their options.
|
170
177
|
|
171
178
|
=== Bundler Integration
|
172
179
|
|
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.description = "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile
|
22
22
|
is used to generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test.
|
23
23
|
The Jarfile.lock can be used to populate the classpath"
|
24
|
-
gem.email = "michael
|
24
|
+
gem.email = "michael@tobedevoured.com"
|
25
25
|
gem.authors = ["Michael Guymon"]
|
26
26
|
gem.executable = "lockjar"
|
27
27
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/bin/lockjar
CHANGED
@@ -1,7 +1,44 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
+
require 'commander/import'
|
3
4
|
require 'lock_jar'
|
4
|
-
require 'lock_jar/cli'
|
5
5
|
|
6
|
-
|
6
|
+
# :name is optional, otherwise uses the basename of this executable
|
7
|
+
program :name, 'Lock Jar'
|
8
|
+
program :version, IO.read( File.expand_path(File.join(File.dirname(__FILE__),'../VERSION')) )
|
9
|
+
program :description, 'LockJar manages Java Jars for Ruby'
|
7
10
|
|
11
|
+
command :install do |c|
|
12
|
+
c.syntax = 'lockjar install'
|
13
|
+
c.description = 'Install Jars from a Jarfile.lock'
|
14
|
+
c.option '--lockfile STRING', String, 'Path to Jarfile.lock, defaults to Jarfile.lock'
|
15
|
+
c.option '--scopes ARRAY', Array, "Scopes to install from Jarfile.lock, defaults to 'compile, runtime'"
|
16
|
+
c.action do |args, options|
|
17
|
+
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
18
|
+
puts "Installing Jars from #{options.lockfile} for #{options.scopes.inspect}"
|
19
|
+
LockJar.install( options.lockfile, options.scopes )
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
command :list do |c|
|
24
|
+
c.syntax = 'lockjar list'
|
25
|
+
c.description = 'List Jars from a Jarfile.lock'
|
26
|
+
c.option '--lockfile STRING', String, 'Path to Jarfile.lock, defaults to Jarfile.lock'
|
27
|
+
c.option '--scopes ARRAY', Array, "Scopes to install from Jarfile.lock, defaults to 'compile, runtime'"
|
28
|
+
c.action do |args, options|
|
29
|
+
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
30
|
+
puts "Listing Jars from #{options.lockfile} for #{options.scopes.inspect}"
|
31
|
+
puts LockJar.list( options.lockfile, options.scopes ).inspect
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
command :lock do |c|
|
36
|
+
c.syntax = 'lockjar lock'
|
37
|
+
c.description = 'Lock Jars in a Jarfile'
|
38
|
+
c.option '--jarfile STRING', String, 'Path to Jarfile, defaults to Jarfile'
|
39
|
+
c.action do |args, options|
|
40
|
+
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
41
|
+
puts "Locking #{options.lockfile}"
|
42
|
+
LockJar.install( options.lockfile, options.scopes )
|
43
|
+
end
|
44
|
+
end
|
data/lib/lock_jar/resolver.rb
CHANGED
@@ -69,12 +69,16 @@ module LockJar
|
|
69
69
|
@naether.add_remote_repository( repo )
|
70
70
|
end
|
71
71
|
|
72
|
-
def resolve( dependencies )
|
72
|
+
def resolve( dependencies, download_artifacts = true )
|
73
73
|
@naether.dependencies = dependencies
|
74
|
-
@naether.resolve_dependencies
|
74
|
+
@naether.resolve_dependencies( download_artifacts )
|
75
75
|
@naether.dependenciesNotation
|
76
76
|
end
|
77
77
|
|
78
|
+
def download( dependencies )
|
79
|
+
@naether.download_artifacts( dependencies )
|
80
|
+
end
|
81
|
+
|
78
82
|
def to_local_paths( notations )
|
79
83
|
paths = []
|
80
84
|
notations.each do |notation|
|
data/lib/lock_jar/runtime.rb
CHANGED
@@ -39,8 +39,17 @@ module LockJar
|
|
39
39
|
@current_resolver
|
40
40
|
end
|
41
41
|
|
42
|
+
def install( jarfile_lock, scopes = ['compile', 'runtime'], opts = {}, &blk )
|
43
|
+
deps = list( jarfile_lock, scopes, opts, &blk )
|
44
|
+
files = resolver(opts).download( deps )
|
45
|
+
|
46
|
+
files
|
47
|
+
end
|
48
|
+
|
42
49
|
def lock( jarfile, opts = {}, &blk )
|
43
50
|
|
51
|
+
opts = {:download => true }.merge( opts )
|
52
|
+
|
44
53
|
lock_jar_file = nil
|
45
54
|
|
46
55
|
if jarfile
|
@@ -114,7 +123,7 @@ module LockJar
|
|
114
123
|
end
|
115
124
|
|
116
125
|
if dependencies.size > 0
|
117
|
-
resolved_notations = resolver(opts).resolve( dependencies )
|
126
|
+
resolved_notations = resolver(opts).resolve( dependencies, opts[:download] == true )
|
118
127
|
|
119
128
|
if lock_data['excludes']
|
120
129
|
lock_data['excludes'].each do |exclude|
|
data/lib/lock_jar.rb
CHANGED
@@ -33,38 +33,30 @@ module LockJar
|
|
33
33
|
Runtime.instance.resolver( opts )
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
# LockJar.lock accepts an Array for parameters. Depending on the type of arg, a different configuration is set.
|
39
|
-
#
|
40
|
-
# * An arg of a String will set the Jarfile, e.g. 'Jarfile.different'. Default Jarfile is *Jarfile*.
|
41
|
-
# * An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
42
|
-
# * :local_repo sets the local repo path
|
43
|
-
# * :lockfile sets the Jarfile.lock path. Default lockfile is *Jarfile.lock*.
|
44
|
-
#
|
45
|
-
# A block can be passed in, overriding values from a Jarfile.
|
46
|
-
#
|
47
|
-
# @return [Hash] Lock data
|
48
|
-
def self.lock( *args, &blk )
|
49
|
-
jarfile = nil
|
36
|
+
def self.install( *args, &blk )
|
37
|
+
lockfile = nil
|
50
38
|
opts = {}
|
39
|
+
scopes = ['compile', 'runtime']
|
51
40
|
|
52
41
|
args.each do |arg|
|
53
42
|
if arg.is_a?(Hash)
|
54
43
|
opts.merge!( arg )
|
55
|
-
elsif arg.is_a?( String )
|
56
|
-
|
44
|
+
elsif arg.is_a?( String )
|
45
|
+
lockfile = arg
|
46
|
+
elsif arg.is_a?( Array )
|
47
|
+
scopes = arg
|
57
48
|
end
|
58
49
|
end
|
59
50
|
|
60
|
-
# default to Jarfile
|
61
|
-
if blk.nil? &&
|
62
|
-
|
51
|
+
# default to Jarfile.lock
|
52
|
+
if blk.nil? && lockfile.nil?
|
53
|
+
lockfile = 'Jarfile.lock'
|
63
54
|
end
|
64
55
|
|
65
|
-
Runtime.instance.
|
56
|
+
Runtime.instance.install( lockfile, scopes, opts, &blk )
|
66
57
|
end
|
67
58
|
|
59
|
+
|
68
60
|
# Lists all dependencies as notations for scopes from the Jarfile.lock. Depending on the type of arg, a different configuration is set.
|
69
61
|
#
|
70
62
|
# * An arg of a String will set the Jarfile.lock, e.g. 'Better.lock'. Default lock file is *Jarfile.lock*.
|
@@ -133,6 +125,39 @@ module LockJar
|
|
133
125
|
Runtime.instance.load( lockfile, scopes, opts, &blk )
|
134
126
|
end
|
135
127
|
|
128
|
+
# Lock a Jarfile and generate a Jarfile.lock.
|
129
|
+
#
|
130
|
+
# LockJar.lock accepts an Array for parameters. Depending on the type of arg, a different configuration is set.
|
131
|
+
#
|
132
|
+
# * An arg of a String will set the Jarfile, e.g. 'Jarfile.different'. Default Jarfile is *Jarfile*.
|
133
|
+
# * An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
134
|
+
# * :download_artifacts if true, will download jars to local repo. Defaults to true.
|
135
|
+
# * :local_repo sets the local repo path
|
136
|
+
# * :lockfile sets the Jarfile.lock path. Default lockfile is *Jarfile.lock*.
|
137
|
+
#
|
138
|
+
# A block can be passed in, overriding values from a Jarfile.
|
139
|
+
#
|
140
|
+
# @return [Hash] Lock data
|
141
|
+
def self.lock( *args, &blk )
|
142
|
+
jarfile = nil
|
143
|
+
opts = {}
|
144
|
+
|
145
|
+
args.each do |arg|
|
146
|
+
if arg.is_a?(Hash)
|
147
|
+
opts.merge!( arg )
|
148
|
+
elsif arg.is_a?( String ) || arg.is_a?( LockJar::Dsl )
|
149
|
+
jarfile = arg
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# default to Jarfile
|
154
|
+
if blk.nil? && jarfile.nil?
|
155
|
+
jarfile = 'Jarfile'
|
156
|
+
end
|
157
|
+
|
158
|
+
Runtime.instance.lock( jarfile, opts, &blk )
|
159
|
+
end
|
160
|
+
|
136
161
|
#
|
137
162
|
# Read a Jafile.lock and convert it to a Hash
|
138
163
|
#
|
@@ -142,4 +167,5 @@ module LockJar
|
|
142
167
|
Runtime.instance.read_lockfile( lockfile )
|
143
168
|
end
|
144
169
|
|
170
|
+
|
145
171
|
end
|
data/lock_jar.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "lock_jar"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Guymon"]
|
12
|
-
s.date = "2012-08-
|
12
|
+
s.date = "2012-08-25"
|
13
13
|
s.description = "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile\n is used to generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test.\n The Jarfile.lock can be used to populate the classpath"
|
14
|
-
s.email = "michael
|
14
|
+
s.email = "michael@tobedevoured.com"
|
15
15
|
s.executables = ["lockjar"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
@@ -27,14 +27,12 @@ Gem::Specification.new do |s|
|
|
27
27
|
"bin/lockjar",
|
28
28
|
"lib/lock_jar.rb",
|
29
29
|
"lib/lock_jar/buildr.rb",
|
30
|
-
"lib/lock_jar/cli.rb",
|
31
30
|
"lib/lock_jar/dsl.rb",
|
32
31
|
"lib/lock_jar/maven.rb",
|
33
32
|
"lib/lock_jar/resolver.rb",
|
34
33
|
"lib/lock_jar/runtime.rb",
|
35
34
|
"lock_jar.gemspec",
|
36
35
|
"spec/Jarfile",
|
37
|
-
"spec/lock_jar/cli_spec.rb",
|
38
36
|
"spec/lock_jar/dsl_spec.rb",
|
39
37
|
"spec/lock_jar/maven_spec.rb",
|
40
38
|
"spec/lock_jar/resolver_spec.rb",
|
@@ -53,20 +51,26 @@ Gem::Specification.new do |s|
|
|
53
51
|
s.specification_version = 3
|
54
52
|
|
55
53
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<naether>, ["~> 0.8.
|
54
|
+
s.add_runtime_dependency(%q<naether>, ["~> 0.8.2"])
|
55
|
+
s.add_runtime_dependency(%q<highline>, ["~> 1.6.13"])
|
56
|
+
s.add_runtime_dependency(%q<commander>, ["~> 4.1.2"])
|
57
57
|
s.add_development_dependency(%q<rspec>, ["~> 2.9.0"])
|
58
58
|
s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
|
59
59
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
60
60
|
s.add_development_dependency(%q<yard>, ["~> 0.8.0"])
|
61
61
|
else
|
62
|
-
s.add_dependency(%q<naether>, ["~> 0.8.
|
62
|
+
s.add_dependency(%q<naether>, ["~> 0.8.2"])
|
63
|
+
s.add_dependency(%q<highline>, ["~> 1.6.13"])
|
64
|
+
s.add_dependency(%q<commander>, ["~> 4.1.2"])
|
63
65
|
s.add_dependency(%q<rspec>, ["~> 2.9.0"])
|
64
66
|
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
65
67
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
66
68
|
s.add_dependency(%q<yard>, ["~> 0.8.0"])
|
67
69
|
end
|
68
70
|
else
|
69
|
-
s.add_dependency(%q<naether>, ["~> 0.8.
|
71
|
+
s.add_dependency(%q<naether>, ["~> 0.8.2"])
|
72
|
+
s.add_dependency(%q<highline>, ["~> 1.6.13"])
|
73
|
+
s.add_dependency(%q<commander>, ["~> 4.1.2"])
|
70
74
|
s.add_dependency(%q<rspec>, ["~> 2.9.0"])
|
71
75
|
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
72
76
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
data/spec/Jarfile
CHANGED
data/spec/lock_jar/dsl_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe LockJar::Dsl do
|
|
6
6
|
jarfile = LockJar::Dsl.evaluate( "spec/Jarfile" )
|
7
7
|
|
8
8
|
jarfile.local_repository.should eql '~/.m2'
|
9
|
-
jarfile.notations.should eql( {"compile"=>["org.apache.mina:mina-core:2.0.4", "pom.xml"], "runtime"=>["pom.xml", "org.apache.tomcat:servlet-api:jar:6.0.35"], "test"=>["pom.xml", "junit:junit:jar:4.10"]} )
|
9
|
+
jarfile.notations.should eql( {"compile"=>["org.apache.mina:mina-core:2.0.4", "spec/pom.xml"], "runtime"=>["spec/pom.xml", "org.apache.tomcat:servlet-api:jar:6.0.35"], "test"=>["spec/pom.xml", "junit:junit:jar:4.10"]} )
|
10
10
|
jarfile.repositories.should eql( ["http://repository.jboss.org/nexus/content/groups/public-jboss"] )
|
11
11
|
end
|
12
12
|
|
data/spec/lock_jar_spec.rb
CHANGED
@@ -5,15 +5,15 @@ require 'naether'
|
|
5
5
|
|
6
6
|
describe LockJar, "#lock" do
|
7
7
|
it "should create a lock file" do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
if File.exists?( 'tmp' )
|
9
|
+
File.delete( 'tmp/Jarfile.lock' ) if File.exists?( 'tmp/Jarfile.lock' )
|
10
|
+
else
|
11
|
+
Dir.mkdir( 'tmp' )
|
12
|
+
end
|
12
13
|
|
13
|
-
LockJar.lock( "Jarfile", :local_repo => '
|
14
|
-
File.exists?( '
|
14
|
+
LockJar.lock( "spec/Jarfile", :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
|
15
|
+
File.exists?( 'tmp/Jarfile.lock' ).should be_true
|
15
16
|
|
16
|
-
Dir.chdir( '../' )
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should not replace dependencies with maps" do
|
@@ -66,16 +66,36 @@ describe LockJar, "#lock" do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
describe LockJar, "#install" do
|
70
|
+
it "should install jars" do
|
71
|
+
|
72
|
+
LockJar.lock( "spec/Jarfile", :download_artifacts => false, :local_repo => 'tmp/test-repo-install', :lockfile => 'tmp/Jarfile.lock' )
|
73
|
+
|
74
|
+
jars = LockJar.install( 'tmp/Jarfile.lock', ['compile'], :local_repo => 'tmp/test-repo-install' )
|
75
|
+
jars.should eql(
|
76
|
+
[ File.expand_path( "tmp/test-repo-install/org/apache/mina/mina-core/2.0.4/mina-core-2.0.4.jar"),
|
77
|
+
File.expand_path( "tmp/test-repo-install/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar"),
|
78
|
+
File.expand_path( "tmp/test-repo-install/com/slackworks/modelcitizen/0.2.2/modelcitizen-0.2.2.jar"),
|
79
|
+
File.expand_path( "tmp/test-repo-install/commons-lang/commons-lang/2.6/commons-lang-2.6.jar"),
|
80
|
+
File.expand_path( "tmp/test-repo-install/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar" ),
|
81
|
+
File.expand_path( "tmp/test-repo-install/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" ),
|
82
|
+
File.expand_path( "tmp/test-repo-install/ch/qos/logback/logback-classic/0.9.24/logback-classic-0.9.24.jar" ),
|
83
|
+
File.expand_path( "tmp/test-repo-install/ch/qos/logback/logback-core/0.9.24/logback-core-0.9.24.jar" ),
|
84
|
+
File.expand_path( "tmp/test-repo-install/com/metapossum/metapossum-scanner/1.0/metapossum-scanner-1.0.jar" ),
|
85
|
+
File.expand_path( "tmp/test-repo-install/commons-io/commons-io/1.4/commons-io-1.4.jar" ),
|
86
|
+
File.expand_path( "tmp/test-repo-install/junit/junit/4.7/junit-4.7.jar" ) ] )
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
69
91
|
describe LockJar, "#list" do
|
70
92
|
it "should list jars" do
|
71
|
-
Dir.chdir( 'spec' )
|
72
93
|
|
73
|
-
LockJar.lock( "Jarfile", :local_repo => '
|
94
|
+
LockJar.lock( "spec/Jarfile", :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
|
74
95
|
|
75
|
-
jars = LockJar.list( '
|
96
|
+
jars = LockJar.list( 'tmp/Jarfile.lock', ['compile', 'runtime', 'bad scope'], :local_repo => 'tmp/test-repo' )
|
76
97
|
jars.should eql( ["org.apache.mina:mina-core:jar:2.0.4", "org.slf4j:slf4j-api:jar:1.6.1", "com.slackworks:modelcitizen:jar:0.2.2", "commons-lang:commons-lang:jar:2.6", "commons-beanutils:commons-beanutils:jar:1.8.3", "commons-logging:commons-logging:jar:1.1.1", "ch.qos.logback:logback-classic:jar:0.9.24", "ch.qos.logback:logback-core:jar:0.9.24", "com.metapossum:metapossum-scanner:jar:1.0", "commons-io:commons-io:jar:1.4", "junit:junit:jar:4.7", "org.apache.tomcat:servlet-api:jar:6.0.35"] )
|
77
98
|
|
78
|
-
Dir.chdir( '../' )
|
79
99
|
end
|
80
100
|
|
81
101
|
it "should replace dependencies with maps" do
|
@@ -109,9 +129,8 @@ describe LockJar, "#load" do
|
|
109
129
|
lambda { Rjb::import('org.apache.mina.core.IoUtil') }.should raise_error
|
110
130
|
end
|
111
131
|
|
112
|
-
Dir.chdir( 'spec' )
|
113
132
|
|
114
|
-
LockJar.lock( "Jarfile", :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
|
133
|
+
LockJar.lock( "spec/Jarfile", :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
|
115
134
|
|
116
135
|
jars = LockJar.load( 'tmp/Jarfile.lock', ['compile', 'runtime'], :local_repo => 'tmp/test-repo' )
|
117
136
|
jars.should eql( [File.expand_path("tmp/test-repo/org/apache/mina/mina-core/2.0.4/mina-core-2.0.4.jar"), File.expand_path("tmp/test-repo/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar"), File.expand_path("tmp/test-repo/com/slackworks/modelcitizen/0.2.2/modelcitizen-0.2.2.jar"), File.expand_path("tmp/test-repo/commons-lang/commons-lang/2.6/commons-lang-2.6.jar"), File.expand_path("tmp/test-repo/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar"), File.expand_path("tmp/test-repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"), File.expand_path("tmp/test-repo/ch/qos/logback/logback-classic/0.9.24/logback-classic-0.9.24.jar"), File.expand_path("tmp/test-repo/ch/qos/logback/logback-core/0.9.24/logback-core-0.9.24.jar"), File.expand_path("tmp/test-repo/com/metapossum/metapossum-scanner/1.0/metapossum-scanner-1.0.jar"), File.expand_path("tmp/test-repo/commons-io/commons-io/1.4/commons-io-1.4.jar"), File.expand_path("tmp/test-repo/junit/junit/4.7/junit-4.7.jar"), File.expand_path("tmp/test-repo/org/apache/tomcat/servlet-api/6.0.35/servlet-api-6.0.35.jar")] )
|
@@ -123,7 +142,6 @@ describe LockJar, "#load" do
|
|
123
142
|
end
|
124
143
|
|
125
144
|
|
126
|
-
Dir.chdir( '../' )
|
127
145
|
end
|
128
146
|
|
129
147
|
it "by block with resolve option" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lock_jar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: naether
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.8.
|
21
|
+
version: 0.8.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,39 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.8.
|
29
|
+
version: 0.8.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: highline
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.6.13
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.6.13
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: commander
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 4.1.2
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.1.2
|
30
62
|
- !ruby/object:Gem::Dependency
|
31
63
|
name: rspec
|
32
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +127,7 @@ description: ! "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile\n
|
|
95
127
|
used to generate a Jarfile.lock that contains all the resolved jar dependencies
|
96
128
|
for scopes runtime, compile, and test.\n The Jarfile.lock can be used to populate
|
97
129
|
the classpath"
|
98
|
-
email: michael
|
130
|
+
email: michael@tobedevoured.com
|
99
131
|
executables:
|
100
132
|
- lockjar
|
101
133
|
extensions: []
|
@@ -112,14 +144,12 @@ files:
|
|
112
144
|
- bin/lockjar
|
113
145
|
- lib/lock_jar.rb
|
114
146
|
- lib/lock_jar/buildr.rb
|
115
|
-
- lib/lock_jar/cli.rb
|
116
147
|
- lib/lock_jar/dsl.rb
|
117
148
|
- lib/lock_jar/maven.rb
|
118
149
|
- lib/lock_jar/resolver.rb
|
119
150
|
- lib/lock_jar/runtime.rb
|
120
151
|
- lock_jar.gemspec
|
121
152
|
- spec/Jarfile
|
122
|
-
- spec/lock_jar/cli_spec.rb
|
123
153
|
- spec/lock_jar/dsl_spec.rb
|
124
154
|
- spec/lock_jar/maven_spec.rb
|
125
155
|
- spec/lock_jar/resolver_spec.rb
|
@@ -142,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
172
|
version: '0'
|
143
173
|
segments:
|
144
174
|
- 0
|
145
|
-
hash: -
|
175
|
+
hash: -1485243867552273056
|
146
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
177
|
none: false
|
148
178
|
requirements:
|
data/lib/lock_jar/cli.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'lock_jar'
|
2
|
-
|
3
|
-
module LockJar
|
4
|
-
class CLI
|
5
|
-
def self.process( args )
|
6
|
-
if args.length > 0
|
7
|
-
args.each do|arg|
|
8
|
-
if arg == "lock"
|
9
|
-
LockJar.lock
|
10
|
-
puts "Jarfile.lock created"
|
11
|
-
elsif arg == "list"
|
12
|
-
puts "Listing Jarfile.lock jars for scopes compile, runtime"
|
13
|
-
puts LockJar.list.inspect
|
14
|
-
end
|
15
|
-
end
|
16
|
-
else
|
17
|
-
puts "Arguments: lock, load, or list"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/spec/lock_jar/cli_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'../spec_helper'))
|
2
|
-
require 'lock_jar/cli'
|
3
|
-
|
4
|
-
describe LockJar::CLI do
|
5
|
-
describe "#process" do
|
6
|
-
it "should lock a Jarfile" do
|
7
|
-
Dir.chdir( 'spec' )
|
8
|
-
LockJar::CLI.process( ['lock'] )
|
9
|
-
|
10
|
-
File.exists?('Jarfile.lock').should be_true
|
11
|
-
|
12
|
-
File.delete( 'Jarfile.lock' ) if File.exists?('Jarfile.lock')
|
13
|
-
|
14
|
-
Dir.chdir( '../' )
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|