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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4ea5120a753aae9eb91e96f329fbcae0c92e9c3
4
- data.tar.gz: 61472dda7102182b9b89585b682d32b26c47063a
3
+ metadata.gz: dfc96065e3e9627fc0db3267dfc96c2749c13bab
4
+ data.tar.gz: 405653c6f9961b07ce3009cf0c04cf9a0834da68
5
5
  SHA512:
6
- metadata.gz: b655a750d8c9144d72d51e7239028a3a7aa62f90434a03199099fd1a68cea9bf57286ba26d536fb50dc2907132a186ea162339da97ee4e9a2f51131188f33b33
7
- data.tar.gz: 52d4ce70c69ff71dc80fef77cf2fc4b864a8ed55809423bdbafdb74b151c117bd0a2db1ad6e50bed6fac1afd1a7163d8af6d5bbf44254e827b9a54e09a375f32
6
+ metadata.gz: 0841da259510056f369cda445a9aea607f1a85b0ffb2ab84fb283eb5a308393589c4138a7e2eca6502905020e3210e61fd67c902ab46aed6fe68b93efc708e79
7
+ data.tar.gz: 44c737e6d62349948a2ac1839d6199d66c1b0abaea839b5bf2df32a23e20ed266b0b8109272db0aa18313a799ed127759342ff64123cd31bdcb793ca6c9c1510
@@ -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
- def lock!(*opts)
43
- definition = ::Bundler.definition
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
- definition.groups.each do |group|
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
 
@@ -1,4 +1,4 @@
1
1
  # the version
2
2
  module LockJar
3
- VERSION = '0.14.4'
3
+ VERSION = '0.14.5'
4
4
  end
@@ -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
- it 'should create Jarfile.lock' do
16
- expect(File).to exist('Jarfile.lock')
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
- describe '.lock_with_bundler' do
21
- it 'should call lock! from Bundler' do
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
- context 'with Bundler.setup' do
28
- it 'should not call lock!' do
29
- LockJar::Bundler.lock_with_bundler(test: :arg)
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
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.14.4
4
+ version: 0.14.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Guymon