lock_jar 0.14.4 → 0.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lock_jar/bundler.rb +8 -33
- data/lib/lock_jar/version.rb +1 -1
- data/spec/lock_jar/bundler_spec.rb +14 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfc96065e3e9627fc0db3267dfc96c2749c13bab
|
4
|
+
data.tar.gz: 405653c6f9961b07ce3009cf0c04cf9a0834da68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0841da259510056f369cda445a9aea607f1a85b0ffb2ab84fb283eb5a308393589c4138a7e2eca6502905020e3210e61fd67c902ab46aed6fe68b93efc708e79
|
7
|
+
data.tar.gz: 44c737e6d62349948a2ac1839d6199d66c1b0abaea839b5bf2df32a23e20ed266b0b8109272db0aa18313a799ed127759342ff64123cd31bdcb793ca6c9c1510
|
data/lib/lock_jar/bundler.rb
CHANGED
@@ -10,40 +10,13 @@ module LockJar
|
|
10
10
|
#
|
11
11
|
class Bundler
|
12
12
|
class << self
|
13
|
-
attr_accessor :skip_lock
|
14
|
-
|
15
|
-
# Patch Bundler::Definition.to_lock to run LockJar::Bundler.lock!
|
16
|
-
def lock_with_bundler(*opts)
|
17
|
-
next if @lock_with_bundler_patched
|
18
|
-
|
19
|
-
::Bundler::Definition.class_eval do
|
20
|
-
alias_method :_lockjar_extended_to_lock, :to_lock
|
21
|
-
define_method(:to_lock) do |*args|
|
22
|
-
result = _lockjar_extended_to_lock
|
23
|
-
|
24
|
-
LockJar::Bundler.lock!(opts) unless LockJar::Bundler.skip_lock
|
25
|
-
|
26
|
-
result
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
::Bundler::Runtime.class_eval do
|
31
|
-
alias_method :_lockjar_extended_setup, :setup
|
32
|
-
define_method(:setup) do |*groups|
|
33
|
-
LockJar::Bundler.skip_lock = true
|
34
|
-
_lockjar_extended_setup
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
@lock_with_bundler_patched = true
|
39
|
-
end
|
40
|
-
|
41
13
|
# Create a lock file from bundled gems
|
42
|
-
|
43
|
-
|
14
|
+
#
|
15
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
16
|
+
def lock!(bundler, *opts)
|
17
|
+
return unless bundler.instance_variable_get('@setup').nil?
|
44
18
|
|
45
19
|
dsl = nil
|
46
|
-
gems_with_jars = []
|
47
20
|
|
48
21
|
jarfile_opt = opts.find { |option| option.is_a? String }
|
49
22
|
|
@@ -58,10 +31,11 @@ module LockJar
|
|
58
31
|
dsl = LockJar::Domain::Dsl.new
|
59
32
|
end
|
60
33
|
|
61
|
-
|
34
|
+
gems_with_jars = []
|
35
|
+
::Bundler.definition.groups.each do |group|
|
62
36
|
puts "[LockJar] Group #{group}:" if ENV['DEBUG']
|
63
37
|
|
64
|
-
definition.specs_for([group]).each do |spec|
|
38
|
+
::Bundler.definition.specs_for([group]).each do |spec|
|
65
39
|
next unless File.exist? File.join(spec.gem_dir, 'Jarfile')
|
66
40
|
|
67
41
|
merged_dsl = merge_gem_dsl(dsl, spec, group)
|
@@ -75,6 +49,7 @@ module LockJar
|
|
75
49
|
puts "[LockJar] Locking Jars for: #{gems_with_jars.inspect}"
|
76
50
|
LockJar.lock(*([dsl] + opts))
|
77
51
|
end
|
52
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
78
53
|
|
79
54
|
private
|
80
55
|
|
data/lib/lock_jar/version.rb
CHANGED
@@ -7,28 +7,27 @@ describe LockJar::Bundler do
|
|
7
7
|
include Spec::Helpers
|
8
8
|
|
9
9
|
describe '.lock!' do
|
10
|
+
let(:bundler) do
|
11
|
+
Class.new { attr_accessor :setup }.new
|
12
|
+
end
|
13
|
+
|
10
14
|
before do
|
11
15
|
remove_file('Jarfile.lock')
|
12
|
-
LockJar::Bundler.lock!('spec/fixtures/Jarfile')
|
13
16
|
end
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
context 'when Bundler.install has run' do
|
19
|
+
it 'should create Jarfile.lock' do
|
20
|
+
LockJar::Bundler.lock!(bundler, 'spec/fixtures/Jarfile')
|
21
|
+
expect(File).to exist('Jarfile.lock')
|
22
|
+
end
|
17
23
|
end
|
18
|
-
end
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
LockJar::Bundler.lock_with_bundler(test: :arg)
|
23
|
-
expect(LockJar::Bundler).to receive(:lock!).with([{ test: :arg }])
|
24
|
-
::Bundler::CLI::Install.new({}).run
|
25
|
-
end
|
25
|
+
context 'when Bundler.setup has run' do
|
26
|
+
before { bundler.setup = true }
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
expect(LockJar::Bundler).to_not receive(:lock!).with([{ test: :arg }])
|
31
|
-
::Bundler::setup
|
28
|
+
it 'should create Jarfile.lock' do
|
29
|
+
LockJar::Bundler.lock!(bundler, 'spec/fixtures/Jarfile')
|
30
|
+
expect(File).to_not exist('Jarfile.lock')
|
32
31
|
end
|
33
32
|
end
|
34
33
|
end
|