lock_jar 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/README.rdoc +28 -9
- data/VERSION +1 -1
- data/lib/lock_jar/resolver.rb +1 -1
- data/lib/lock_jar/runtime.rb +9 -5
- data/lock_jar.gemspec +1 -1
- data/spec/lock_jar/bundler_spec.rb +2 -1
- data/spec/lock_jar/runtime_spec.rb +2 -2
- data/spec/lock_jar_spec.rb +0 -1
- metadata +10 -10
data/README.rdoc
CHANGED
@@ -46,7 +46,11 @@ Example Jarfile
|
|
46
46
|
|
47
47
|
==== Resolving dependencies
|
48
48
|
|
49
|
-
* LockJar.lock(
|
49
|
+
* LockJar.lock( *args ): Using a Jarfile, creates a lock file. Default jarfile is *Jarfile* and default lockfile is *Jarfile.lock*.
|
50
|
+
* An arg of a String will set the Jarfile, e.g. 'Jarfile.different'
|
51
|
+
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
52
|
+
* :local_repo sets the local repo path
|
53
|
+
* :lockfile sets the Jarfile.lock path
|
50
54
|
|
51
55
|
When the Jarfile is locked, the transitive dependencies are resolved and saved to the Jarfile.lock file.
|
52
56
|
|
@@ -97,16 +101,17 @@ The Jarfile.lock
|
|
97
101
|
==== Accessing Jars
|
98
102
|
|
99
103
|
* LockJar.list(*args): Lists all dependencies as notations for scopes from the Jarfile.lock. Defaults scopes are *compile* and *runtime*. Default lock file is *Jarfile.lock*.
|
100
|
-
*
|
101
|
-
*
|
102
|
-
*
|
104
|
+
* An arg of a String will set the Jarfile.lock, e.g. 'Better.lock'
|
105
|
+
* An arg of an Array will set the scopes, e.g. ['compile','test']
|
106
|
+
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
103
107
|
* :local_repo sets the local repo path
|
104
108
|
* :local_paths converts the notations to paths to jars in the local repo path
|
109
|
+
* :resolve to true will make transitive dependences resolve before loading to classpath
|
105
110
|
|
106
111
|
* 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*.
|
107
|
-
*
|
108
|
-
*
|
109
|
-
*
|
112
|
+
* An arg of a String will set the Jarfile.lock, e.g. 'Better.lock'
|
113
|
+
* An arg of an Array will set the scopes, e.g. ['compile','test']
|
114
|
+
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
110
115
|
* :local_repo sets the local repo path
|
111
116
|
* :resolve to true will make transitive dependences resolve before loading to classpath
|
112
117
|
|
@@ -122,14 +127,28 @@ Do not forget, if you change your Jarfile, you have to re-generate the Jarfile.l
|
|
122
127
|
|
123
128
|
==== Skipping the Jarfile
|
124
129
|
|
125
|
-
You can skip the Jarfile and Jarfile.lock to directly
|
130
|
+
You can skip the Jarfile and Jarfile.lock to directly play with dependencies by passing a block to LockJar.lock, LockJar.list, LockJar.load
|
131
|
+
|
132
|
+
===== Lock with a Jarfile
|
133
|
+
|
134
|
+
LockJar.lock do
|
135
|
+
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
136
|
+
end
|
137
|
+
|
138
|
+
===== List with a Jarfile
|
139
|
+
|
140
|
+
LockJar.list do
|
141
|
+
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
142
|
+
end
|
143
|
+
|
144
|
+
===== Load with a Jarfile
|
126
145
|
|
127
146
|
LockJar.load do
|
128
147
|
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
129
148
|
end
|
130
149
|
|
131
150
|
Since you skipped the locking part, mostly likely you will need to resolve the dependences in the block, just pass the
|
132
|
-
:resolve => true option to enable dependency resolution.
|
151
|
+
:resolve => true option to enable dependency resolution (also works for LockJar.list).
|
133
152
|
|
134
153
|
LockJar.load( :resolve => true ) do
|
135
154
|
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/lock_jar/resolver.rb
CHANGED
@@ -59,7 +59,7 @@ module LockJar
|
|
59
59
|
@naether = Naether.create_from_jars( jars )
|
60
60
|
end
|
61
61
|
|
62
|
-
@naether.local_repo_path = opts[:local_repo] if opts[:local_repo]
|
62
|
+
@naether.local_repo_path = opts[:local_repo].to_s if opts[:local_repo]
|
63
63
|
|
64
64
|
|
65
65
|
@naether.clear_remote_repositories if opts[:offline]
|
data/lib/lock_jar/runtime.rb
CHANGED
@@ -27,6 +27,10 @@ module LockJar
|
|
27
27
|
attr_reader :current_resolver
|
28
28
|
|
29
29
|
def resolver( opts = {} )
|
30
|
+
if opts[:local_repo]
|
31
|
+
opts[:local_repo] = File.expand_path(opts[:local_repo])
|
32
|
+
end
|
33
|
+
|
30
34
|
# XXX: opts for a method will cause resolver to reload
|
31
35
|
if @current_resolver.nil? || opts != @current_resolver.opts
|
32
36
|
@current_resolver = LockJar::Resolver.new( opts )
|
@@ -169,6 +173,10 @@ module LockJar
|
|
169
173
|
dependencies = mapped_dependencies
|
170
174
|
end
|
171
175
|
|
176
|
+
if opts[:resolve]
|
177
|
+
dependencies = resolver(opts).resolve( dependencies )
|
178
|
+
end
|
179
|
+
|
172
180
|
if opts[:local_paths]
|
173
181
|
opts.delete( :local_paths ) # remove list opts so resolver is not reset
|
174
182
|
resolver(opts).to_local_paths( dependencies.uniq )
|
@@ -196,11 +204,7 @@ module LockJar
|
|
196
204
|
end
|
197
205
|
|
198
206
|
dependencies = list( jarfile_lock, scopes, opts, &blk )
|
199
|
-
|
200
|
-
if opts[:resolve]
|
201
|
-
dependencies = resolver(opts).resolve( dependencies )
|
202
|
-
end
|
203
|
-
|
207
|
+
|
204
208
|
resolver(opts).load_to_classpath( dependencies )
|
205
209
|
end
|
206
210
|
|
data/lock_jar.gemspec
CHANGED
@@ -14,13 +14,13 @@ describe LockJar::Runtime do
|
|
14
14
|
local 'dsl_config'
|
15
15
|
end
|
16
16
|
|
17
|
-
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql 'tmp/param_config'
|
17
|
+
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql File.expand_path('tmp/param_config')
|
18
18
|
|
19
19
|
LockJar::Runtime.instance.load( nil ) do
|
20
20
|
local 'tmp/dsl_config'
|
21
21
|
end
|
22
22
|
|
23
|
-
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql 'tmp/dsl_config'
|
23
|
+
LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql File.expand_path('tmp/dsl_config')
|
24
24
|
|
25
25
|
end
|
26
26
|
end
|
data/spec/lock_jar_spec.rb
CHANGED
@@ -104,7 +104,6 @@ describe LockJar, "#load" do
|
|
104
104
|
LockJar.lock( "spec/Jarfile", :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
|
105
105
|
|
106
106
|
jars = LockJar.load( 'tmp/Jarfile.lock', ['compile', 'runtime'], :local_repo => 'tmp/test-repo' )
|
107
|
-
|
108
107
|
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")] )
|
109
108
|
|
110
109
|
if Naether.platform == 'java'
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: naether
|
16
|
-
requirement: &
|
16
|
+
requirement: &15583440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *15583440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &15580160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.9.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *15580160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &15700940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.1.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *15700940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &15697920 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 1.6.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *15697920
|
58
58
|
description: ! "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile\n is
|
59
59
|
used to generate a Jarfile.lock that contains all the resolved jar dependencies
|
60
60
|
for scopes runtime, compile, and test.\n The Jarfile.lock can be used to populate
|
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
segments:
|
107
107
|
- 0
|
108
|
-
hash:
|
108
|
+
hash: -3207536742551290776
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
none: false
|
111
111
|
requirements:
|