bundler-multilock 1.0.3 → 1.0.4
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.
- checksums.yaml +4 -4
- data/lib/bundler/multilock/check.rb +27 -5
- data/lib/bundler/multilock/version.rb +1 -1
- data/lib/bundler/multilock.rb +31 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 514c6dd3f4961f833ea20dee15047941b649cdbe787f94808d9547e310ac7ff0
|
4
|
+
data.tar.gz: 79b046545b14b3b29c33a629e528cf9bf60712337052b0381fc1b6bf240228c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d071c456f788219cfb144b70cfb3161f1b53d9add8d9a2d5395be1bceb56f1681abd787047ec1e6f109c2937944756cf9b7f4cd85ff6ad9483666d46f3acfa2d
|
7
|
+
data.tar.gz: 887dbb68890c5f643fdfb925eade83055afd262115a3a8970dd900955d1793ba4109569a56f9d4f273229023a051b63aec86c05fce2c6bf7ecc6bfe59f00e95b
|
@@ -23,9 +23,20 @@ module Bundler
|
|
23
23
|
return true unless Bundler.default_lockfile.exist?
|
24
24
|
|
25
25
|
success = true
|
26
|
+
missing_specs = base_check({ gemfile: Bundler.default_gemfile, lockfile: Bundler.default_lockfile },
|
27
|
+
return_missing: true).to_set
|
28
|
+
|
26
29
|
Multilock.lockfile_definitions.each do |lockfile_definition|
|
27
|
-
next
|
30
|
+
next if lockfile_definition[:lockfile] == Bundler.default_lockfile
|
31
|
+
|
32
|
+
unless lockfile_definition[:lockfile].exist?
|
33
|
+
Bundler.ui.error("Lockfile #{lockfile_definition[:lockfile]} does not exist.")
|
34
|
+
success = false
|
35
|
+
end
|
28
36
|
|
37
|
+
new_missing = base_check(lockfile_definition, log_missing: missing_specs, return_missing: true)
|
38
|
+
success = false unless new_missing.empty?
|
39
|
+
missing_specs.merge(new_missing)
|
29
40
|
success = false unless check(lockfile_definition)
|
30
41
|
end
|
31
42
|
success
|
@@ -33,21 +44,32 @@ module Bundler
|
|
33
44
|
|
34
45
|
# this is mostly equivalent to the built in checks in `bundle check`, but even
|
35
46
|
# more conservative, and returns false instead of exiting on failure
|
36
|
-
def base_check(lockfile_definition)
|
37
|
-
return false unless lockfile_definition[:lockfile].file?
|
47
|
+
def base_check(lockfile_definition, log_missing: false, return_missing: false)
|
48
|
+
return return_missing ? [] : false unless lockfile_definition[:lockfile].file?
|
38
49
|
|
39
50
|
Multilock.prepare_block = lockfile_definition[:prepare]
|
40
51
|
definition = Definition.build(lockfile_definition[:gemfile], lockfile_definition[:lockfile], false)
|
41
|
-
return false unless definition.send(:current_platform_locked?)
|
52
|
+
return return_missing ? [] : false unless definition.send(:current_platform_locked?)
|
42
53
|
|
43
54
|
begin
|
44
55
|
definition.validate_runtime!
|
45
56
|
definition.resolve_only_locally!
|
46
57
|
not_installed = definition.missing_specs
|
47
58
|
rescue RubyVersionMismatch, GemNotFound, SolveFailure
|
48
|
-
return false
|
59
|
+
return return_missing ? [] : false
|
60
|
+
end
|
61
|
+
|
62
|
+
if log_missing
|
63
|
+
not_installed.each do |spec|
|
64
|
+
next if log_missing.include?(spec)
|
65
|
+
|
66
|
+
Bundler.ui.error "The following gems are missing" if log_missing.empty?
|
67
|
+
Bundler.ui.error(" * #{spec.name} (#{spec.version})")
|
68
|
+
end
|
49
69
|
end
|
50
70
|
|
71
|
+
return not_installed if return_missing
|
72
|
+
|
51
73
|
not_installed.empty? && definition.no_resolve_needed?
|
52
74
|
ensure
|
53
75
|
Multilock.prepare_block = nil
|
data/lib/bundler/multilock.rb
CHANGED
@@ -362,8 +362,36 @@ module Bundler
|
|
362
362
|
end
|
363
363
|
|
364
364
|
def write_lockfile(lockfile_definition, lockfile, install:, dependency_changes: false)
|
365
|
-
|
366
|
-
|
365
|
+
prepare_block = lockfile_definition[:prepare]
|
366
|
+
|
367
|
+
gemfile = lockfile_definition[:gemfile]
|
368
|
+
# use avoid Definition.build, so that we don't have to evaluate
|
369
|
+
# the gemfile multiple times, each time we need a separate definition
|
370
|
+
builder = Dsl.new
|
371
|
+
builder.eval_gemfile(gemfile, &prepare_block) if prepare_block
|
372
|
+
builder.eval_gemfile(gemfile)
|
373
|
+
|
374
|
+
definition = builder.to_definition(lockfile, {})
|
375
|
+
definition.instance_variable_set(:@dependency_changes, dependency_changes) if dependency_changes
|
376
|
+
orig_definition = definition.dup # we might need it twice
|
377
|
+
|
378
|
+
current_lockfile = lockfile_definition[:lockfile]
|
379
|
+
if current_lockfile.exist?
|
380
|
+
definition.instance_variable_set(:@lockfile_contents, current_lockfile.read)
|
381
|
+
if install
|
382
|
+
current_definition = builder.to_definition(current_lockfile, {})
|
383
|
+
begin
|
384
|
+
current_definition.resolve_only_locally!
|
385
|
+
if current_definition.missing_specs.any?
|
386
|
+
Bundler.with_default_lockfile(current_lockfile) do
|
387
|
+
Installer.install(gemfile.dirname, current_definition, {})
|
388
|
+
end
|
389
|
+
end
|
390
|
+
rescue RubyVersionMismatch, GemNotFound, SolveFailure
|
391
|
+
# ignore
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
367
395
|
|
368
396
|
resolved_remotely = false
|
369
397
|
begin
|
@@ -372,7 +400,7 @@ module Bundler
|
|
372
400
|
begin
|
373
401
|
definition.resolve_with_cache!
|
374
402
|
rescue GemNotFound, SolveFailure
|
375
|
-
definition =
|
403
|
+
definition = orig_definition
|
376
404
|
|
377
405
|
definition.resolve_remotely!
|
378
406
|
resolved_remotely = true
|
@@ -391,18 +419,6 @@ module Bundler
|
|
391
419
|
end
|
392
420
|
|
393
421
|
!definition.nothing_changed?
|
394
|
-
ensure
|
395
|
-
self.prepare_block = nil
|
396
|
-
end
|
397
|
-
|
398
|
-
def build_definition(lockfile_definition, lockfile, dependency_changes:)
|
399
|
-
definition = Definition.build(lockfile_definition[:gemfile], lockfile, false)
|
400
|
-
definition.instance_variable_set(:@dependency_changes, dependency_changes) if dependency_changes
|
401
|
-
if lockfile_definition[:lockfile].exist?
|
402
|
-
definition.instance_variable_set(:@lockfile_contents,
|
403
|
-
lockfile_definition[:lockfile].read)
|
404
|
-
end
|
405
|
-
definition
|
406
422
|
end
|
407
423
|
end
|
408
424
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler-multilock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|