bundler 4.1.0.beta3 → 4.1.0
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/build_metadata.rb +2 -2
- data/lib/bundler/checksum.rb +8 -2
- data/lib/bundler/cli/clean.rb +19 -3
- data/lib/bundler/cli/exec.rb +1 -1
- data/lib/bundler/cli/install.rb +1 -1
- data/lib/bundler/cli/lock.rb +12 -0
- data/lib/bundler/cli/update.rb +1 -1
- data/lib/bundler/cli.rb +2 -0
- data/lib/bundler/definition.rb +125 -3
- data/lib/bundler/dsl.rb +6 -2
- data/lib/bundler/errors.rb +8 -0
- data/lib/bundler/fetcher/downloader.rb +7 -3
- data/lib/bundler/index.rb +7 -2
- data/lib/bundler/inline.rb +16 -8
- data/lib/bundler/installer.rb +19 -0
- data/lib/bundler/lazy_specification.rb +42 -25
- data/lib/bundler/lockfile_generator.rb +21 -9
- data/lib/bundler/lockfile_parser.rb +21 -5
- data/lib/bundler/man/bundle-lock.1 +7 -1
- data/lib/bundler/man/bundle-lock.1.ronn +10 -0
- data/lib/bundler/man/bundle-plugin.1 +61 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +84 -0
- data/lib/bundler/man/gemfile.5 +3 -1
- data/lib/bundler/man/gemfile.5.ronn +11 -3
- data/lib/bundler/match_platform.rb +3 -3
- data/lib/bundler/mirror.rb +7 -5
- data/lib/bundler/resolver.rb +2 -0
- data/lib/bundler/ruby_dsl.rb +2 -1
- data/lib/bundler/rubygems_ext.rb +41 -9
- data/lib/bundler/rubygems_integration.rb +2 -4
- data/lib/bundler/runtime.rb +24 -10
- data/lib/bundler/source/git/git_proxy.rb +18 -6
- data/lib/bundler/source/git.rb +0 -2
- data/lib/bundler/spec_set.rb +26 -7
- data/lib/bundler/stub_specification.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +4 -0
- data/lib/bundler.rb +1 -1
- data/lib/rubygems/compact_index_client/http_fetcher.rb +3 -1
- data/lib/rubygems/yaml_serializer.rb +128 -46
- metadata +2 -2
|
@@ -8,7 +8,7 @@ module Bundler
|
|
|
8
8
|
include MatchPlatform
|
|
9
9
|
include ForcePlatform
|
|
10
10
|
|
|
11
|
-
attr_reader :name, :version, :platform, :materialization, :
|
|
11
|
+
attr_reader :name, :version, :platform, :materialization, :content_addresses
|
|
12
12
|
attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
|
|
13
13
|
attr_accessor :overrides
|
|
14
14
|
|
|
@@ -27,7 +27,14 @@ module Bundler
|
|
|
27
27
|
alias_method :runtime_dependencies, :dependencies
|
|
28
28
|
|
|
29
29
|
def self.from_spec(s)
|
|
30
|
-
|
|
30
|
+
content_addresses = if s.is_a?(LazySpecification)
|
|
31
|
+
s.content_addresses
|
|
32
|
+
elsif s.content_address
|
|
33
|
+
{ s.content_address => Gem::ContentAddress.ruby_abi_for(s.required_ruby_version) }
|
|
34
|
+
else
|
|
35
|
+
{}
|
|
36
|
+
end
|
|
37
|
+
lazy_spec = new(s.name, s.version, s.platform, s.source, content_addresses: content_addresses)
|
|
31
38
|
lazy_spec.dependencies = s.runtime_dependencies
|
|
32
39
|
lazy_spec.required_ruby_version = s.required_ruby_version
|
|
33
40
|
lazy_spec.required_rubygems_version = s.required_rubygems_version
|
|
@@ -35,14 +42,14 @@ module Bundler
|
|
|
35
42
|
lazy_spec
|
|
36
43
|
end
|
|
37
44
|
|
|
38
|
-
def initialize(name, version, platform, source = nil,
|
|
45
|
+
def initialize(name, version, platform, source = nil, content_addresses: {}, **materialization_options)
|
|
39
46
|
@name = name
|
|
40
47
|
@version = version
|
|
41
48
|
@dependencies = []
|
|
42
49
|
@required_ruby_version = Gem::Requirement.default
|
|
43
50
|
@required_rubygems_version = Gem::Requirement.default
|
|
44
51
|
@platform = platform || Gem::Platform::RUBY
|
|
45
|
-
|
|
52
|
+
self.content_addresses = content_addresses
|
|
46
53
|
|
|
47
54
|
@original_source = source
|
|
48
55
|
@source = source
|
|
@@ -53,6 +60,14 @@ module Bundler
|
|
|
53
60
|
@materialization = nil
|
|
54
61
|
end
|
|
55
62
|
|
|
63
|
+
def content_addresses=(addresses)
|
|
64
|
+
@content_addresses = addresses.sort_by {|address, ruby_abi| [ruby_abi.to_s, address] }.to_h
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def content_addressed_full_names
|
|
68
|
+
@content_addresses.keys.map {|address| "#{@name}-#{@version}-#{address}" }
|
|
69
|
+
end
|
|
70
|
+
|
|
56
71
|
def missing?
|
|
57
72
|
@materialization == self
|
|
58
73
|
end
|
|
@@ -66,9 +81,7 @@ module Bundler
|
|
|
66
81
|
end
|
|
67
82
|
|
|
68
83
|
def full_name
|
|
69
|
-
@full_name ||= if Gem::
|
|
70
|
-
"#{@name}-#{@version}-#{@content_address}"
|
|
71
|
-
elsif platform == Gem::Platform::RUBY
|
|
84
|
+
@full_name ||= if platform == Gem::Platform::RUBY
|
|
72
85
|
"#{@name}-#{@version}"
|
|
73
86
|
else
|
|
74
87
|
"#{@name}-#{@version}-#{platform}"
|
|
@@ -84,7 +97,7 @@ module Bundler
|
|
|
84
97
|
end
|
|
85
98
|
|
|
86
99
|
def name_tuple
|
|
87
|
-
Gem::NameTuple.new(@name, @version, @platform
|
|
100
|
+
Gem::NameTuple.new(@name, @version, @platform)
|
|
88
101
|
end
|
|
89
102
|
|
|
90
103
|
def ==(other)
|
|
@@ -119,16 +132,6 @@ module Bundler
|
|
|
119
132
|
@name == dependency.name && effective_requirement.satisfied_by?(Gem::Version.new(@version))
|
|
120
133
|
end
|
|
121
134
|
|
|
122
|
-
##
|
|
123
|
-
# Assigns the content address parsed from the lockfile's CONTENT
|
|
124
|
-
# ADDRESSES section. The full name embeds the content address, so its
|
|
125
|
-
# memoization must be invalidated.
|
|
126
|
-
|
|
127
|
-
def content_address=(value)
|
|
128
|
-
@content_address = value
|
|
129
|
-
@full_name = nil
|
|
130
|
-
end
|
|
131
|
-
|
|
132
135
|
def to_lock
|
|
133
136
|
out = String.new
|
|
134
137
|
out << " #{lock_name}\n"
|
|
@@ -141,10 +144,12 @@ module Bundler
|
|
|
141
144
|
out
|
|
142
145
|
end
|
|
143
146
|
|
|
147
|
+
# Every gem this row may install: the platform gem and each content-addressed
|
|
148
|
+
# gem it lists, so a cache serves all the Rubies the lockfile covers.
|
|
144
149
|
def materialize_for_cache
|
|
145
150
|
source.remote!
|
|
146
151
|
|
|
147
|
-
materialize(self
|
|
152
|
+
Array(materialize(self) {|specs| specs })
|
|
148
153
|
end
|
|
149
154
|
|
|
150
155
|
def materialized_for_installation(locked_platforms = nil)
|
|
@@ -157,7 +162,7 @@ module Bundler
|
|
|
157
162
|
source.local!
|
|
158
163
|
|
|
159
164
|
if use_exact_resolved_specifications?
|
|
160
|
-
spec = materialize(self) {|specs| choose_compatible(specs, fallback_to_non_installable: false) }
|
|
165
|
+
spec = materialize(self, content_addressed_only: content_address_locked_for_running_ruby?) {|specs| choose_compatible(specs, fallback_to_non_installable: false) }
|
|
161
166
|
return spec if spec
|
|
162
167
|
|
|
163
168
|
# Exact spec is incompatible; in frozen mode, try to find a compatible platform variant
|
|
@@ -205,7 +210,7 @@ module Bundler
|
|
|
205
210
|
# Used for legacy lockfiles and as a fallback when the exact locked spec
|
|
206
211
|
# is incompatible. Falls back to frozen bundle behavior if none match.
|
|
207
212
|
def resolve_best_platform(specs, locked_platforms: nil)
|
|
208
|
-
specs = MatchPlatform.select_all_content_address_match(specs,
|
|
213
|
+
specs = MatchPlatform.select_all_content_address_match(specs, content_addresses)
|
|
209
214
|
|
|
210
215
|
find_compatible_platform_spec(specs, locked_platforms: locked_platforms) || frozen_bundle_fallback(specs)
|
|
211
216
|
end
|
|
@@ -213,7 +218,7 @@ module Bundler
|
|
|
213
218
|
def find_compatible_platform_spec(specs, locked_platforms: nil)
|
|
214
219
|
candidate_platforms(locked_platforms: locked_platforms).each do |plat|
|
|
215
220
|
candidates = MatchPlatform.select_best_platform_match(specs, plat)
|
|
216
|
-
spec = choose_compatible(candidates, fallback_to_non_installable: false)
|
|
221
|
+
spec = choose_compatible(candidates, fallback_to_non_installable: false, locked_platforms: locked_platforms)
|
|
217
222
|
return spec if spec
|
|
218
223
|
end
|
|
219
224
|
nil
|
|
@@ -247,8 +252,16 @@ module Bundler
|
|
|
247
252
|
(most_specific_locked_platform != generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
|
|
248
253
|
end
|
|
249
254
|
|
|
250
|
-
|
|
255
|
+
# Once the lockfile pins the running Ruby's content-addressed gem, the
|
|
256
|
+
# platform gem an earlier frozen fallback installed no longer satisfies the
|
|
257
|
+
# row, so the pinned gem gets installed instead.
|
|
258
|
+
def content_address_locked_for_running_ruby?
|
|
259
|
+
Gem::ContentAddress.platform_eligible?(platform) && content_addresses.value?(Gem.ruby_abi)
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def materialize(query, content_addressed_only: false)
|
|
251
263
|
matching_specs = source.specs.search(query)
|
|
264
|
+
matching_specs = matching_specs.select {|spec| Gem::ContentAddress.content_addressed?(spec, validate_ruby_abi: false) } if content_addressed_only
|
|
252
265
|
return self if matching_specs.empty?
|
|
253
266
|
|
|
254
267
|
yield matching_specs
|
|
@@ -259,7 +272,7 @@ module Bundler
|
|
|
259
272
|
# lockfile, which is not allowed. In that case, we will give a proper error
|
|
260
273
|
# about the mismatch higher up the stack, right before trying to install the
|
|
261
274
|
# bad gem.
|
|
262
|
-
def choose_compatible(candidates, fallback_to_non_installable: Bundler.frozen_bundle
|
|
275
|
+
def choose_compatible(candidates, fallback_to_non_installable: Bundler.frozen_bundle?, locked_platforms: nil)
|
|
263
276
|
override_list = overrides || []
|
|
264
277
|
search = candidates.reverse.find do |spec|
|
|
265
278
|
spec.is_a?(StubSpecification) || spec.matches_current_metadata_with_overrides?(override_list)
|
|
@@ -271,7 +284,11 @@ module Bundler
|
|
|
271
284
|
if search
|
|
272
285
|
validate_dependencies(search) if search.platform == platform
|
|
273
286
|
|
|
274
|
-
|
|
287
|
+
if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
|
|
288
|
+
# A frozen fallback onto a variant the lockfile locks too, like the
|
|
289
|
+
# ruby gem, installs a locked gem rather than an insecure one.
|
|
290
|
+
search.locked_platform = locked_platforms&.include?(search.platform) ? search.platform : platform
|
|
291
|
+
end
|
|
275
292
|
end
|
|
276
293
|
search
|
|
277
294
|
end
|
|
@@ -22,6 +22,7 @@ module Bundler
|
|
|
22
22
|
add_overrides
|
|
23
23
|
add_content_addresses
|
|
24
24
|
add_checksums
|
|
25
|
+
add_ruby_abis
|
|
25
26
|
add_locked_ruby_version
|
|
26
27
|
add_bundled_with
|
|
27
28
|
|
|
@@ -74,17 +75,20 @@ module Bundler
|
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
def add_content_addresses
|
|
77
|
-
content_addresses = definition.resolve.
|
|
78
|
-
next
|
|
78
|
+
content_addresses = definition.resolve.flat_map do |spec|
|
|
79
|
+
next [] if spec.platform == Gem::Platform::RUBY
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
spec.content_addresses.zip(spec.content_addressed_full_names).map do |(content_address, ruby_abi), full_name|
|
|
82
|
+
line = "#{spec.lock_name} #{content_address}"
|
|
83
|
+
line += " abi=#{ruby_abi}" if ruby_abi
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
if definition.locked_checksums
|
|
86
|
+
checksums = spec.source.checksum_store.checksums_to_lock(full_name)
|
|
87
|
+
line += " #{checksums}" if checksums
|
|
88
|
+
end
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
line
|
|
91
|
+
end
|
|
88
92
|
end
|
|
89
93
|
|
|
90
94
|
add_section("CONTENT ADDRESSES", content_addresses) unless content_addresses.empty?
|
|
@@ -95,7 +99,7 @@ module Bundler
|
|
|
95
99
|
checksums = definition.resolve.filter_map do |spec|
|
|
96
100
|
line = spec.source.checksum_store.to_lock(spec)
|
|
97
101
|
|
|
98
|
-
next if line == spec.lock_name &&
|
|
102
|
+
next if line == spec.lock_name && spec.content_addresses.any?
|
|
99
103
|
|
|
100
104
|
line
|
|
101
105
|
end
|
|
@@ -103,6 +107,14 @@ module Bundler
|
|
|
103
107
|
add_section("CHECKSUMS", checksums + bundler_checksum)
|
|
104
108
|
end
|
|
105
109
|
|
|
110
|
+
def add_ruby_abis
|
|
111
|
+
ruby_abis = definition.ruby_abis
|
|
112
|
+
return if ruby_abis.empty? || definition.resolve.none? {|spec| spec.content_addresses.any? }
|
|
113
|
+
|
|
114
|
+
out << "\nRUBY ABIS\n"
|
|
115
|
+
ruby_abis.each {|ruby_abi| out << " #{ruby_abi}\n" }
|
|
116
|
+
end
|
|
117
|
+
|
|
106
118
|
def add_locked_ruby_version
|
|
107
119
|
return unless locked_ruby_version = definition.locked_ruby_version
|
|
108
120
|
add_section("RUBY VERSION", locked_ruby_version.to_s)
|
|
@@ -37,6 +37,7 @@ module Bundler
|
|
|
37
37
|
:ruby_version,
|
|
38
38
|
:checksums,
|
|
39
39
|
:overrides,
|
|
40
|
+
:ruby_abis,
|
|
40
41
|
)
|
|
41
42
|
|
|
42
43
|
BUNDLED = "BUNDLED WITH"
|
|
@@ -46,6 +47,7 @@ module Bundler
|
|
|
46
47
|
OVERRIDES = "OVERRIDES"
|
|
47
48
|
PLATFORMS = "PLATFORMS"
|
|
48
49
|
RUBY = "RUBY VERSION"
|
|
50
|
+
RUBY_ABIS = "RUBY ABIS"
|
|
49
51
|
GIT = "GIT"
|
|
50
52
|
GEM = "GEM"
|
|
51
53
|
PATH = "PATH"
|
|
@@ -60,7 +62,7 @@ module Bundler
|
|
|
60
62
|
Gem::Version.create("1.12") => [RUBY].freeze,
|
|
61
63
|
Gem::Version.create("1.13") => [PLUGIN].freeze,
|
|
62
64
|
Gem::Version.create("2.5.0") => [CHECKSUMS].freeze,
|
|
63
|
-
Gem::Version.create("4.1.0") => [CONTENT_ADDRESSES].freeze,
|
|
65
|
+
Gem::Version.create("4.1.0") => [CONTENT_ADDRESSES, RUBY_ABIS].freeze,
|
|
64
66
|
}.freeze
|
|
65
67
|
|
|
66
68
|
# OVERRIDES is deliberately not in SECTIONS_BY_VERSION_INTRODUCED. Sections
|
|
@@ -107,6 +109,7 @@ module Bundler
|
|
|
107
109
|
@platforms = []
|
|
108
110
|
@sources = []
|
|
109
111
|
@metadata_source = Source::Metadata.new
|
|
112
|
+
@ruby_abis = []
|
|
110
113
|
@dependencies = {}
|
|
111
114
|
@parse_method = nil
|
|
112
115
|
@specs = {}
|
|
@@ -118,6 +121,7 @@ module Bundler
|
|
|
118
121
|
end
|
|
119
122
|
@pos = Position.new(1, 1)
|
|
120
123
|
@strict = strict
|
|
124
|
+
@spec_names_by_source = {}.compare_by_identity
|
|
121
125
|
|
|
122
126
|
if lockfile.match?(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
|
|
123
127
|
raise LockfileError, "Your #{@lockfile_path} contains merge conflicts.\n" \
|
|
@@ -158,6 +162,8 @@ module Bundler
|
|
|
158
162
|
@parse_method = :parse_platform
|
|
159
163
|
elsif line == RUBY
|
|
160
164
|
@parse_method = :parse_ruby
|
|
165
|
+
elsif line == RUBY_ABIS
|
|
166
|
+
@parse_method = :parse_ruby_abi
|
|
161
167
|
elsif line == BUNDLED
|
|
162
168
|
@parse_method = :parse_bundled_with
|
|
163
169
|
elsif /^[^\s]/.match?(line)
|
|
@@ -168,6 +174,8 @@ module Bundler
|
|
|
168
174
|
@pos.advance!(line)
|
|
169
175
|
end
|
|
170
176
|
|
|
177
|
+
@spec_names_by_source.each {|source, names| source.add_dependency_names(names) }
|
|
178
|
+
|
|
171
179
|
if @platforms.include?(Gem::Platform::X64_MINGW_LEGACY)
|
|
172
180
|
SharedHelpers.feature_deprecated!("Found x64-mingw32 in lockfile, which is deprecated and will be removed in the future.")
|
|
173
181
|
end
|
|
@@ -247,6 +255,7 @@ module Bundler
|
|
|
247
255
|
#{space}\(([^-]*) # Space, followed by version
|
|
248
256
|
-(.*)\) # Platform, always present for content-addressable gems
|
|
249
257
|
#{space}([0-9a-f]{8,64}) # Content address
|
|
258
|
+
(?:#{space}abi=(\d+\.\d+))? # Optional Ruby ABI the gem is built for
|
|
250
259
|
(?:#{space}([^ ]+))? # Optional checksums
|
|
251
260
|
$ # Line end
|
|
252
261
|
/xo
|
|
@@ -325,19 +334,21 @@ module Bundler
|
|
|
325
334
|
version = Gem::Version.new($2)
|
|
326
335
|
platform = Gem::Platform.new($3)
|
|
327
336
|
content_address = $4
|
|
328
|
-
|
|
337
|
+
ruby_abi = $5
|
|
338
|
+
checksums = $6
|
|
329
339
|
|
|
330
340
|
spec = @specs[Gem::NameTuple.new(name, version, platform).full_name]
|
|
331
341
|
return unless spec
|
|
332
342
|
|
|
333
|
-
spec.
|
|
343
|
+
spec.content_addresses = spec.content_addresses.merge(content_address => ruby_abi)
|
|
334
344
|
|
|
335
345
|
return unless checksums
|
|
336
346
|
|
|
347
|
+
gem = Gem::NameTuple.new(name, version, platform, content_address: content_address)
|
|
337
348
|
checksums.split(",") do |lock_checksum|
|
|
338
349
|
column = line.index(lock_checksum) + 1
|
|
339
350
|
checksum = Checksum.from_lock(lock_checksum, "#{@lockfile_path}:#{@pos.line}:#{column}")
|
|
340
|
-
spec.source.checksum_store.register(
|
|
351
|
+
spec.source.checksum_store.register(gem, checksum)
|
|
341
352
|
end
|
|
342
353
|
end
|
|
343
354
|
|
|
@@ -354,7 +365,7 @@ module Bundler
|
|
|
354
365
|
version = Gem::Version.new(version)
|
|
355
366
|
platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
|
|
356
367
|
@current_spec = LazySpecification.new(name, version, platform, @current_source, strict: @strict)
|
|
357
|
-
@current_source
|
|
368
|
+
(@spec_names_by_source[@current_source] ||= []) << name
|
|
358
369
|
|
|
359
370
|
@specs[@current_spec.full_name] = @current_spec
|
|
360
371
|
elsif spaces.size == 6
|
|
@@ -368,6 +379,11 @@ module Bundler
|
|
|
368
379
|
@platforms << Gem::Platform.new($1.strip) if line =~ /^ (.*)$/
|
|
369
380
|
end
|
|
370
381
|
|
|
382
|
+
def parse_ruby_abi(line)
|
|
383
|
+
ruby_abi = line.strip
|
|
384
|
+
@ruby_abis << ruby_abi if Gem::ContentAddress.valid_ruby_abi?(ruby_abi)
|
|
385
|
+
end
|
|
386
|
+
|
|
371
387
|
def parse_bundled_with(line)
|
|
372
388
|
line.strip!
|
|
373
389
|
return unless Gem::Version.correct?(line)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
.SH "NAME"
|
|
5
5
|
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
|
|
6
6
|
.SH "SYNOPSIS"
|
|
7
|
-
\fBbundle lock\fR [\-\-update] [\-\-bundler[=BUNDLER]] [\-\-local] [\-\-print] [\-\-lockfile=PATH] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-add\-checksums] [\-\-add\-platform] [\-\-remove\-platform] [\-\-normalize\-platforms] [\-\-patch] [\-\-minor] [\-\-major] [\-\-pre] [\-\-strict] [\-\-conservative] [\-\-cooldown=NUMBER]
|
|
7
|
+
\fBbundle lock\fR [\-\-update] [\-\-bundler[=BUNDLER]] [\-\-local] [\-\-print] [\-\-lockfile=PATH] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-add\-checksums] [\-\-add\-platform] [\-\-remove\-platform] [\-\-normalize\-platforms] [\-\-add\-ruby\-abi] [\-\-remove\-ruby\-abi] [\-\-patch] [\-\-minor] [\-\-major] [\-\-pre] [\-\-strict] [\-\-conservative] [\-\-cooldown=NUMBER]
|
|
8
8
|
.SH "DESCRIPTION"
|
|
9
9
|
Lock the gems specified in Gemfile\.
|
|
10
10
|
.SH "OPTIONS"
|
|
@@ -42,6 +42,12 @@ Remove a platform from the lockfile\.
|
|
|
42
42
|
\fB\-\-normalize\-platforms\fR
|
|
43
43
|
Normalize lockfile platforms\.
|
|
44
44
|
.TP
|
|
45
|
+
\fB\-\-add\-ruby\-abi=<list>\fR
|
|
46
|
+
Lock the content\-addressed gems of the bundle for a Ruby ABI (a major and minor version, like \fB3\.4\fR), re\-resolving to record them\. Running \fBbundle install\fR under that Ruby does the same\.
|
|
47
|
+
.TP
|
|
48
|
+
\fB\-\-remove\-ruby\-abi=<list>\fR
|
|
49
|
+
Drop the content\-addressed gems for a Ruby ABI from the lockfile\.
|
|
50
|
+
.TP
|
|
45
51
|
\fB\-\-patch\fR
|
|
46
52
|
If updating, prefer updating only to next patch version\.
|
|
47
53
|
.TP
|
|
@@ -14,6 +14,8 @@ bundle-lock(1) -- Creates / Updates a lockfile without installing
|
|
|
14
14
|
[--add-platform]
|
|
15
15
|
[--remove-platform]
|
|
16
16
|
[--normalize-platforms]
|
|
17
|
+
[--add-ruby-abi]
|
|
18
|
+
[--remove-ruby-abi]
|
|
17
19
|
[--patch]
|
|
18
20
|
[--minor]
|
|
19
21
|
[--major]
|
|
@@ -68,6 +70,14 @@ Lock the gems specified in Gemfile.
|
|
|
68
70
|
* `--normalize-platforms`:
|
|
69
71
|
Normalize lockfile platforms.
|
|
70
72
|
|
|
73
|
+
* `--add-ruby-abi=<list>`:
|
|
74
|
+
Lock the content-addressed gems of the bundle for a Ruby ABI (a
|
|
75
|
+
major and minor version, like `3.4`), re-resolving to record them. Running
|
|
76
|
+
`bundle install` under that Ruby does the same.
|
|
77
|
+
|
|
78
|
+
* `--remove-ruby-abi=<list>`:
|
|
79
|
+
Drop the content-addressed gems for a Ruby ABI from the lockfile.
|
|
80
|
+
|
|
71
81
|
* `--patch`:
|
|
72
82
|
If updating, prefer updating only to next patch version.
|
|
73
83
|
|
|
@@ -69,6 +69,67 @@ No options\.
|
|
|
69
69
|
Describe subcommands or one specific subcommand\.
|
|
70
70
|
.P
|
|
71
71
|
No options\.
|
|
72
|
+
.SH "HOOKS"
|
|
73
|
+
A plugin can run code at defined points of Bundler's work by registering a hook\. In the plugin's \fBplugins\.rb\fR, pass one of the event constants of \fBBundler::Plugin::Events\fR and a block to \fBBundler::Plugin::API\.hook\fR\. Bundler loads a plugin that registers a hook for an event when that event fires, and calls the block with the arguments listed for the event below\.
|
|
74
|
+
.IP "" 4
|
|
75
|
+
.nf
|
|
76
|
+
Bundler::Plugin::API\.hook Bundler::Plugin::Events::GEM_BEFORE_INSTALL_ALL do |dependencies|
|
|
77
|
+
puts "about to install #{dependencies\.map(&:name)\.join(", ")}"
|
|
78
|
+
end
|
|
79
|
+
.fi
|
|
80
|
+
.IP "" 0
|
|
81
|
+
.P
|
|
82
|
+
The events fire in the order listed here\.
|
|
83
|
+
.P
|
|
84
|
+
\fBGEMFILE EVALUATION\fR
|
|
85
|
+
.TP
|
|
86
|
+
\fBGEM_BEFORE_EVAL\fR (\fBbefore\-eval\fR)
|
|
87
|
+
Called before the Gemfile is evaluated, with the path to the Gemfile and the path to the lockfile (\fBnil\fR when there is no lockfile)\.
|
|
88
|
+
.TP
|
|
89
|
+
\fBGEM_AFTER_EVAL\fR (\fBafter\-eval\fR)
|
|
90
|
+
Called after the Gemfile is evaluated, with the resulting \fBBundler::Definition\fR\.
|
|
91
|
+
.P
|
|
92
|
+
\fBINSTALLATION\fR
|
|
93
|
+
.TP
|
|
94
|
+
\fBGEM_BEFORE_INSTALL_ALL\fR (\fBbefore\-install\-all\fR)
|
|
95
|
+
Called before any gem is installed, with an Array of the \fBBundler::Dependency\fR objects declared in the Gemfile\.
|
|
96
|
+
.TP
|
|
97
|
+
\fBGEM_BEFORE_FETCH\fR (\fBbefore\-fetch\fR)
|
|
98
|
+
Called before each individual gem is downloaded from a remote source, with a spec\-like object responding to the \fBGem::Specification\fR API (for example a \fBBundler::EndpointSpecification\fR or \fBBundler::RemoteSpecification\fR)\. Does not fire for a gem that is already present in the download cache\.
|
|
99
|
+
.TP
|
|
100
|
+
\fBGEM_AFTER_FETCH\fR (\fBafter\-fetch\fR)
|
|
101
|
+
Called after each individual gem is downloaded from a remote source, with the same spec\-like object as \fBGEM_BEFORE_FETCH\fR\. Also fires when the download fails\.
|
|
102
|
+
.TP
|
|
103
|
+
\fBGIT_BEFORE_FETCH\fR (\fBbefore\-git\-fetch\fR)
|
|
104
|
+
Called before a git source is fetched or checked out, with the \fBBundler::Source::Git\fR being fetched\.
|
|
105
|
+
.TP
|
|
106
|
+
\fBGIT_AFTER_FETCH\fR (\fBafter\-git\-fetch\fR)
|
|
107
|
+
Called after a git source is fetched or checked out, with the same \fBBundler::Source::Git\fR\. Also fires when the fetch or checkout fails\.
|
|
108
|
+
.TP
|
|
109
|
+
\fBGEM_BEFORE_INSTALL\fR (\fBbefore\-install\fR)
|
|
110
|
+
Called before each individual gem is installed, with a \fBBundler::ParallelInstaller::SpecInstallation\fR\. Its \fBstate\fR, \fBerror\fR and \fBpost_install_message\fR are not set yet, as nothing has been installed\.
|
|
111
|
+
.TP
|
|
112
|
+
\fBGEM_AFTER_INSTALL\fR (\fBafter\-install\fR)
|
|
113
|
+
Called after each individual gem is installed, with the same \fBBundler::ParallelInstaller::SpecInstallation\fR\. If its \fBstate\fR is \fBfailed\fR, \fBerror\fR holds the exception; if the \fBstate\fR is \fBsuccess\fR, a \fBpost_install_message\fR may be present\.
|
|
114
|
+
.TP
|
|
115
|
+
\fBGEM_AFTER_INSTALL_ALL\fR (\fBafter\-install\-all\fR)
|
|
116
|
+
Called after all gems are installed, with an Array of the \fBBundler::Dependency\fR objects declared in the Gemfile\.
|
|
117
|
+
.P
|
|
118
|
+
\fBREQUIRE\fR
|
|
119
|
+
.P
|
|
120
|
+
These events fire from \fBBundler\.require\fR\.
|
|
121
|
+
.TP
|
|
122
|
+
\fBGEM_BEFORE_REQUIRE_ALL\fR (\fBbefore\-require\-all\fR)
|
|
123
|
+
Called before any gem is required, with an Array of the \fBBundler::Dependency\fR objects being required\.
|
|
124
|
+
.TP
|
|
125
|
+
\fBGEM_BEFORE_REQUIRE\fR (\fBbefore\-require\fR)
|
|
126
|
+
Called before each individual gem is required, with its \fBBundler::Dependency\fR\.
|
|
127
|
+
.TP
|
|
128
|
+
\fBGEM_AFTER_REQUIRE\fR (\fBafter\-require\fR)
|
|
129
|
+
Called after each individual gem is required, with its \fBBundler::Dependency\fR\.
|
|
130
|
+
.TP
|
|
131
|
+
\fBGEM_AFTER_REQUIRE_ALL\fR (\fBafter\-require\-all\fR)
|
|
132
|
+
Called after all gems are required, with an Array of the \fBBundler::Dependency\fR objects that were required\.
|
|
72
133
|
.SH "SEE ALSO"
|
|
73
134
|
.IP "\(bu" 4
|
|
74
135
|
How to write a Bundler plugin \fIhttps://guides\.rubygems\.org/bundler_plugins/\fR
|
|
@@ -79,6 +79,90 @@ Describe subcommands or one specific subcommand.
|
|
|
79
79
|
|
|
80
80
|
No options.
|
|
81
81
|
|
|
82
|
+
## HOOKS
|
|
83
|
+
|
|
84
|
+
A plugin can run code at defined points of Bundler's work by registering a
|
|
85
|
+
hook. In the plugin's `plugins.rb`, pass one of the event constants of
|
|
86
|
+
`Bundler::Plugin::Events` and a block to `Bundler::Plugin::API.hook`. Bundler
|
|
87
|
+
loads a plugin that registers a hook for an event when that event fires, and
|
|
88
|
+
calls the block with the arguments listed for the event below.
|
|
89
|
+
|
|
90
|
+
Bundler::Plugin::API.hook Bundler::Plugin::Events::GEM_BEFORE_INSTALL_ALL do |dependencies|
|
|
91
|
+
puts "about to install #{dependencies.map(&:name).join(", ")}"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
The events fire in the order listed here.
|
|
95
|
+
|
|
96
|
+
**GEMFILE EVALUATION**
|
|
97
|
+
|
|
98
|
+
* `GEM_BEFORE_EVAL` (`before-eval`):
|
|
99
|
+
Called before the Gemfile is evaluated, with the path to the Gemfile and
|
|
100
|
+
the path to the lockfile (`nil` when there is no lockfile).
|
|
101
|
+
|
|
102
|
+
* `GEM_AFTER_EVAL` (`after-eval`):
|
|
103
|
+
Called after the Gemfile is evaluated, with the resulting
|
|
104
|
+
`Bundler::Definition`.
|
|
105
|
+
|
|
106
|
+
**INSTALLATION**
|
|
107
|
+
|
|
108
|
+
* `GEM_BEFORE_INSTALL_ALL` (`before-install-all`):
|
|
109
|
+
Called before any gem is installed, with an Array of the
|
|
110
|
+
`Bundler::Dependency` objects declared in the Gemfile.
|
|
111
|
+
|
|
112
|
+
* `GEM_BEFORE_FETCH` (`before-fetch`):
|
|
113
|
+
Called before each individual gem is downloaded from a remote source, with
|
|
114
|
+
a spec-like object responding to the `Gem::Specification` API (for example
|
|
115
|
+
a `Bundler::EndpointSpecification` or `Bundler::RemoteSpecification`).
|
|
116
|
+
Does not fire for a gem that is already present in the download cache.
|
|
117
|
+
|
|
118
|
+
* `GEM_AFTER_FETCH` (`after-fetch`):
|
|
119
|
+
Called after each individual gem is downloaded from a remote source, with
|
|
120
|
+
the same spec-like object as `GEM_BEFORE_FETCH`. Also fires when the
|
|
121
|
+
download fails.
|
|
122
|
+
|
|
123
|
+
* `GIT_BEFORE_FETCH` (`before-git-fetch`):
|
|
124
|
+
Called before a git source is fetched or checked out, with the
|
|
125
|
+
`Bundler::Source::Git` being fetched.
|
|
126
|
+
|
|
127
|
+
* `GIT_AFTER_FETCH` (`after-git-fetch`):
|
|
128
|
+
Called after a git source is fetched or checked out, with the same
|
|
129
|
+
`Bundler::Source::Git`. Also fires when the fetch or checkout fails.
|
|
130
|
+
|
|
131
|
+
* `GEM_BEFORE_INSTALL` (`before-install`):
|
|
132
|
+
Called before each individual gem is installed, with a
|
|
133
|
+
`Bundler::ParallelInstaller::SpecInstallation`. Its `state`, `error` and
|
|
134
|
+
`post_install_message` are not set yet, as nothing has been installed.
|
|
135
|
+
|
|
136
|
+
* `GEM_AFTER_INSTALL` (`after-install`):
|
|
137
|
+
Called after each individual gem is installed, with the same
|
|
138
|
+
`Bundler::ParallelInstaller::SpecInstallation`. If its `state` is
|
|
139
|
+
`failed`, `error` holds the exception; if the `state` is `success`, a
|
|
140
|
+
`post_install_message` may be present.
|
|
141
|
+
|
|
142
|
+
* `GEM_AFTER_INSTALL_ALL` (`after-install-all`):
|
|
143
|
+
Called after all gems are installed, with an Array of the
|
|
144
|
+
`Bundler::Dependency` objects declared in the Gemfile.
|
|
145
|
+
|
|
146
|
+
**REQUIRE**
|
|
147
|
+
|
|
148
|
+
These events fire from `Bundler.require`.
|
|
149
|
+
|
|
150
|
+
* `GEM_BEFORE_REQUIRE_ALL` (`before-require-all`):
|
|
151
|
+
Called before any gem is required, with an Array of the
|
|
152
|
+
`Bundler::Dependency` objects being required.
|
|
153
|
+
|
|
154
|
+
* `GEM_BEFORE_REQUIRE` (`before-require`):
|
|
155
|
+
Called before each individual gem is required, with its
|
|
156
|
+
`Bundler::Dependency`.
|
|
157
|
+
|
|
158
|
+
* `GEM_AFTER_REQUIRE` (`after-require`):
|
|
159
|
+
Called after each individual gem is required, with its
|
|
160
|
+
`Bundler::Dependency`.
|
|
161
|
+
|
|
162
|
+
* `GEM_AFTER_REQUIRE_ALL` (`after-require-all`):
|
|
163
|
+
Called after all gems are required, with an Array of the
|
|
164
|
+
`Bundler::Dependency` objects that were required.
|
|
165
|
+
|
|
82
166
|
## SEE ALSO
|
|
83
167
|
|
|
84
168
|
* [How to write a Bundler plugin](https://guides.rubygems.org/bundler_plugins/)
|
data/lib/bundler/man/gemfile.5
CHANGED
|
@@ -82,7 +82,7 @@ ruby "2\.6\.8", engine: "jruby", engine_version: "9\.3\.8\.0"
|
|
|
82
82
|
.fi
|
|
83
83
|
.IP "" 0
|
|
84
84
|
.SS "PATCHLEVEL"
|
|
85
|
-
Each application \fImay\fR specify a Ruby patchlevel\.
|
|
85
|
+
Each application \fImay\fR specify a Ruby patchlevel\. The option is accepted for compatibility with existing Gemfiles and ignored: the patchlevel has been uniquely determined by the combination of major, minor, and teeny version numbers since Ruby 2\.1\.0 was released, so Bundler does not compare it against the patchlevel of the running Ruby\.
|
|
86
86
|
.P
|
|
87
87
|
This option was implemented in Bundler 1\.4\.0 for Ruby 2\.0 or earlier\.
|
|
88
88
|
.IP "" 4
|
|
@@ -468,6 +468,8 @@ The \fBgemspec\fR method adds any runtime dependencies as gem requirements in th
|
|
|
468
468
|
.P
|
|
469
469
|
The \fBgemspec\fR method supports optional \fB:path\fR, \fB:glob\fR, \fB:name\fR, and \fB:development_group\fR options, which control where bundler looks for the \fB\.gemspec\fR, the glob it uses to look for the gemspec (defaults to: \fB{,*,*/*}\.gemspec\fR), what named \fB\.gemspec\fR it uses (if more than one is present), and which group development dependencies are included in\.
|
|
470
470
|
.P
|
|
471
|
+
When \fBgemspec\fR is called inside a \fBgroup\fR block, the gem requirement on your project goes into that group instead of the default group, and so do its runtime dependencies\. Development dependencies stay in the \fBdevelopment\fR group, or the group given by \fB:development_group\fR\. An enclosing \fBplatforms\fR or \fBinstall_if\fR block applies to the project and its development dependencies alike\.
|
|
472
|
+
.P
|
|
471
473
|
When a \fBgemspec\fR dependency encounters version conflicts during resolution, the local version under development will always be selected \-\- even if there are remote versions that better match other requirements for the \fBgemspec\fR gem\.
|
|
472
474
|
.SH "EVAL_GEMFILE"
|
|
473
475
|
A Gemfile \fBMAY\fR be split across multiple files\. The \fBeval_gemfile\fR method reads the contents of another file as if they appeared in the current Gemfile\. A relative path is resolved against the directory of the file containing the call\.
|
|
@@ -111,9 +111,11 @@ engine version specified _must_ match the Ruby version.
|
|
|
111
111
|
|
|
112
112
|
### PATCHLEVEL
|
|
113
113
|
|
|
114
|
-
Each application _may_ specify a Ruby patchlevel.
|
|
115
|
-
|
|
116
|
-
uniquely determined by
|
|
114
|
+
Each application _may_ specify a Ruby patchlevel. The option is accepted for
|
|
115
|
+
compatibility with existing Gemfiles and ignored: the patchlevel has been
|
|
116
|
+
uniquely determined by the combination of major, minor, and teeny version
|
|
117
|
+
numbers since Ruby 2.1.0 was released, so Bundler does not compare it against
|
|
118
|
+
the patchlevel of the running Ruby.
|
|
117
119
|
|
|
118
120
|
This option was implemented in Bundler 1.4.0 for Ruby 2.0 or earlier.
|
|
119
121
|
|
|
@@ -560,6 +562,12 @@ options, which control where bundler looks for the `.gemspec`, the glob it uses
|
|
|
560
562
|
for the gemspec (defaults to: `{,*,*/*}.gemspec`), what named `.gemspec` it uses
|
|
561
563
|
(if more than one is present), and which group development dependencies are included in.
|
|
562
564
|
|
|
565
|
+
When `gemspec` is called inside a `group` block, the gem requirement on your
|
|
566
|
+
project goes into that group instead of the default group, and so do its runtime
|
|
567
|
+
dependencies. Development dependencies stay in the `development` group, or the
|
|
568
|
+
group given by `:development_group`. An enclosing `platforms` or `install_if`
|
|
569
|
+
block applies to the project and its development dependencies alike.
|
|
570
|
+
|
|
563
571
|
When a `gemspec` dependency encounters version conflicts during resolution, the
|
|
564
572
|
local version under development will always be selected -- even if there are
|
|
565
573
|
remote versions that better match other requirements for the `gemspec` gem.
|
|
@@ -20,10 +20,10 @@ module Bundler
|
|
|
20
20
|
Gem::Platform.sort_and_filter_best_platform_match(matching, platform)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def self.select_all_content_address_match(specs,
|
|
24
|
-
return specs
|
|
23
|
+
def self.select_all_content_address_match(specs, content_addresses)
|
|
24
|
+
return specs if content_addresses.empty?
|
|
25
25
|
|
|
26
|
-
specs.
|
|
26
|
+
specs.reject {|spec| Gem::ContentAddress.match?(spec.content_address) && !content_addresses.include?(spec.content_address) }
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def self.prefer_content_addressable(matching)
|
data/lib/bundler/mirror.rb
CHANGED
|
@@ -151,9 +151,11 @@ module Bundler
|
|
|
151
151
|
socket.connect_nonblock(address)
|
|
152
152
|
rescue Errno::EINPROGRESS
|
|
153
153
|
wait_for_writtable_socket(socket, address, timeout)
|
|
154
|
-
rescue
|
|
154
|
+
rescue SystemCallError # Connection failed somehow, again
|
|
155
155
|
false
|
|
156
156
|
end
|
|
157
|
+
rescue SocketError # The mirror host does not resolve
|
|
158
|
+
false
|
|
157
159
|
end
|
|
158
160
|
|
|
159
161
|
private
|
|
@@ -185,7 +187,7 @@ module Bundler
|
|
|
185
187
|
class MirrorSockets
|
|
186
188
|
def initialize(mirror)
|
|
187
189
|
@timeout = mirror.fallback_timeout
|
|
188
|
-
@addresses = Socket.getaddrinfo(mirror.uri.
|
|
190
|
+
@addresses = Socket.getaddrinfo(mirror.uri.hostname, mirror.uri.port, nil, Socket::SOCK_STREAM).map do |address|
|
|
189
191
|
SocketAddress.new(address[0], address[3], address[1])
|
|
190
192
|
end
|
|
191
193
|
end
|
|
@@ -194,9 +196,9 @@ module Bundler
|
|
|
194
196
|
@addresses.any? do |address|
|
|
195
197
|
socket = Socket.new(Socket.const_get(address.type), Socket::SOCK_STREAM, 0)
|
|
196
198
|
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
yield socket, address.to_socket_address, @timeout
|
|
200
|
+
ensure
|
|
201
|
+
socket&.close
|
|
200
202
|
end
|
|
201
203
|
end
|
|
202
204
|
end
|
data/lib/bundler/resolver.rb
CHANGED
|
@@ -546,6 +546,8 @@ module Bundler
|
|
|
546
546
|
@cooldown_skipped_specs.each do |(name, version), spec|
|
|
547
547
|
resolved = resolved_versions[name]
|
|
548
548
|
next unless resolved && version > resolved
|
|
549
|
+
package = @base.get_package(name)
|
|
550
|
+
next if !package.unlock? && package.locked_version == resolved
|
|
549
551
|
next unless requirements[name].all? {|req| req.satisfied_by?(version) }
|
|
550
552
|
newest = newest_skipped[name]
|
|
551
553
|
newest_skipped[name] = spec if newest.nil? || version > newest.version
|