lock_jar 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -0
- data/VERSION +1 -1
- data/lib/lock_jar/bundler.rb +2 -2
- data/lib/lock_jar/domain/dsl_helper.rb +24 -6
- data/lock_jar.gemspec +1 -1
- data/spec/lock_jar_spec.rb +2 -2
- metadata +1 -1
data/README.md
CHANGED
@@ -325,6 +325,33 @@ Bundler calls `setup` and `require`. To enable this support, add this require t
|
|
325
325
|
You can optionally create a _Jarfile_ that will automatically be included when you `bundle install` or `bundle update`. Otherwise
|
326
326
|
Gems with a Jarfile will be merge to generate a _Jarfile.lock_. The Jarfile.lock will be loaded when Bundler calls `setup` or `require`.
|
327
327
|
|
328
|
+
### Bundler to LockJar groups
|
329
|
+
|
330
|
+
LockJar will merge the dependencies from the `default` and `runtime` group of a Gem's _Jarfile_. These will be placed in the
|
331
|
+
lockfile under Gem's corresponding Bundler group. For example, the following Gemfile:
|
332
|
+
|
333
|
+
group :development do
|
334
|
+
gem 'solr_sail', '~>0.1.0'
|
335
|
+
end
|
336
|
+
|
337
|
+
Would produce the follow _Jarfile.lock_ excerpt:
|
338
|
+
|
339
|
+
---
|
340
|
+
version: 0.7.0
|
341
|
+
merged:
|
342
|
+
- gem:solr_sail:gems/solr_sail-0.1.0-java/Jarfile
|
343
|
+
groups:
|
344
|
+
default:
|
345
|
+
dependencies: []
|
346
|
+
artifacts: []
|
347
|
+
development:
|
348
|
+
dependencies:
|
349
|
+
- ch.qos.logback:logback-classic:jar:1.0.6
|
350
|
+
- ch.qos.logback:logback-core:jar:1.0.6
|
351
|
+
- com.google.guava:guava:jar:r05
|
352
|
+
|
353
|
+
Since `solr_sail` is defined in the _Gemfile's_ `development` group, the corresponding _Jarfile.lock_ dependencies are also under the `development` group.
|
354
|
+
|
328
355
|
## License
|
329
356
|
|
330
357
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/lib/lock_jar/bundler.rb
CHANGED
@@ -27,7 +27,7 @@ module LockJar
|
|
27
27
|
LockJar.load( lockfile, groups )
|
28
28
|
|
29
29
|
if ENV["DEBUG"]
|
30
|
-
puts "[LockJar] Loaded Jars
|
30
|
+
puts "[LockJar] Loaded Jars for #{groups.inspect}: #{LockJar::Registry.instance.loaded_jars.inspect}"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -135,7 +135,7 @@ module Bundler
|
|
135
135
|
|
136
136
|
spec_dsl = LockJar::Domain::GemDsl.create( spec, "Jarfile" )
|
137
137
|
|
138
|
-
dsl = LockJar::Domain::DslHelper.merge( dsl, spec_dsl )
|
138
|
+
dsl = LockJar::Domain::DslHelper.merge( dsl, spec_dsl, group.to_s )
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -21,18 +21,36 @@ module LockJar
|
|
21
21
|
|
22
22
|
#
|
23
23
|
# Merge LockJar::Domain::Dsl
|
24
|
-
#
|
25
|
-
|
24
|
+
# @param [LockJar::Domain::Dsl] into_dsl dsl that is merged into
|
25
|
+
# @param [LockJar::Domain::Dsl] from_dsl dsl that is merged from
|
26
|
+
# @param [String] into_group force only runtime and default groups to be loaded into this group
|
27
|
+
# @return [LockJar::Domain::Dsl]
|
28
|
+
def merge( into_dsl, from_dsl, into_group = nil )
|
26
29
|
into_dsl.remote_repositories = (into_dsl.remote_repositories + from_dsl.remote_repositories).uniq
|
27
30
|
|
28
|
-
|
29
|
-
|
30
|
-
artifacts
|
31
|
+
# merge default and runtime group into specific group
|
32
|
+
if into_group
|
33
|
+
group_artifacts = into_dsl.artifacts[into_group] || []
|
34
|
+
defaults = from_dsl.artifacts['default'] || []
|
35
|
+
runtime = from_dsl.artifacts['runtime'] || []
|
36
|
+
( defaults + runtime ).each do |art|
|
31
37
|
unless group_artifacts.include? art
|
32
38
|
group_artifacts << art
|
33
39
|
end
|
34
40
|
end
|
35
|
-
into_dsl.artifacts[
|
41
|
+
into_dsl.artifacts[into_group] = group_artifacts
|
42
|
+
|
43
|
+
# one to one merging of groups
|
44
|
+
else
|
45
|
+
from_dsl.artifacts.each do |group, artifacts|
|
46
|
+
group_artifacts = into_dsl.artifacts[group] || []
|
47
|
+
artifacts.each do |art|
|
48
|
+
unless group_artifacts.include? art
|
49
|
+
group_artifacts << art
|
50
|
+
end
|
51
|
+
end
|
52
|
+
into_dsl.artifacts[group] = group_artifacts
|
53
|
+
end
|
36
54
|
end
|
37
55
|
|
38
56
|
from_dsl.maps.each do |artifact,paths|
|
data/lock_jar.gemspec
CHANGED
data/spec/lock_jar_spec.rb
CHANGED
@@ -104,7 +104,7 @@ describe LockJar, "#lock" do
|
|
104
104
|
File.exists?( 'tmp/Jarfile.lock' ).should be_true
|
105
105
|
lockfile = LockJar.read('tmp/Jarfile.lock')
|
106
106
|
lockfile.to_hash.should eql({
|
107
|
-
"version"=>
|
107
|
+
"version"=> LockJar::VERSION,
|
108
108
|
"excludes"=>["commons-logging", "logkit"],
|
109
109
|
"groups"=>{
|
110
110
|
"default"=>{
|
@@ -142,7 +142,7 @@ describe LockJar, "#lock" do
|
|
142
142
|
|
143
143
|
lockfile = LockJar.read('tmp/NoRepoJarfile.lock')
|
144
144
|
lockfile.to_hash.should eql({
|
145
|
-
"version"=>
|
145
|
+
"version"=> LockJar::VERSION,
|
146
146
|
"groups"=>{
|
147
147
|
"default"=>{
|
148
148
|
"dependencies"=>["org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016",
|