bundler 4.0.23 → 4.0.25

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ec361c599b55bcc5b770889047d0a539d2788e65025307f06401454c015897c
4
- data.tar.gz: ac97ed4c20f2f9fbbd629f41ae9630f34b37fa3eab192c6dc136a6a7eeab1c91
3
+ metadata.gz: 649559a08a7cdf4e7f1e01a09932e27609e953c4a02c209bc211aafab2698d7f
4
+ data.tar.gz: c8f07e60fcab30979e19c7a0e6351f4d613bdb5cc55db9eb233409784e32f0f8
5
5
  SHA512:
6
- metadata.gz: a6860a40c1b9b692d6d9ed0fbf6d76b7d0ce0a32dc661d24783c637ce9bed2e1552808953fedd5349bd102984df027fb1b9f250f226cc05e7965259a4806b2ff
7
- data.tar.gz: 81891f385b11b80572b9ec4be939462a944d34072e0ddad6d238084b1dc80a5f7dba37154796f6e70d8d93ece45a2152f15ab97255e6cf425a8404749a600332
6
+ metadata.gz: 1d27bbacf73937cc1abcfebd619a5aebe3ed3b01fcc93853725d241de1b922bedc190c7580fb6cb1fac94f7e0f3f0621ced80e76e9ac018d05fdd7589b3a3cc9
7
+ data.tar.gz: 2aa866f87c326b21b518c5bb5e40f4f19bfe2a524e6285fcb809793e15a9c74390d7821873aafef7d10c64bd5506b3954067539e3c38bb106a0f4a3654c95f31
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.25 / 2026-11-25
4
+
5
+ ### Bug fixes:
6
+
7
+ * Retry resolution with transitive prereleases. Pull request [#10110](https://github.com/ruby/rubygems/pull/10110) by Hiroshi SHIBATA
8
+ * Allow full updates to downgrade a yanked gem. Pull request [#10106](https://github.com/ruby/rubygems/pull/10106) by Hiroshi SHIBATA
9
+ * Allow `bundle lock --add-platform` to add native platforms from JRuby. Pull request [#10105](https://github.com/ruby/rubygems/pull/10105) by Hiroshi SHIBATA
10
+ * Show fourth-segment and prerelease updates in `bundle outdated --filter-patch`. Pull request [#10103](https://github.com/ruby/rubygems/pull/10103) by Hiroshi SHIBATA
11
+ * Resolve dependencies before `bundle add` updates the Gemfile. Pull request [#10101](https://github.com/ruby/rubygems/pull/10101) by Hiroshi SHIBATA
12
+ * Read plugin index files that Bundler 4.1 writes. Pull request [#10077](https://github.com/ruby/rubygems/pull/10077) by Hiroshi SHIBATA
13
+ * Preload git sources that share a cache one after another: 4.0.x. Pull request [#10069](https://github.com/ruby/rubygems/pull/10069) by Hiroshi SHIBATA
14
+ * Fix Bundler mirror probing with `fallback_timeout`. Pull request [#10046](https://github.com/ruby/rubygems/pull/10046) by Hiroshi SHIBATA
15
+
16
+ ## 4.0.24 / 2026-11-05
17
+
18
+ ### Enhancements:
19
+
20
+ * Read the Ruby version from mise's inline table form. Pull request [#9991](https://github.com/ruby/rubygems/pull/9991) by Hiroshi SHIBATA
21
+ * Report which locked gems can't be materialized for the current platform. Pull request [#9738](https://github.com/ruby/rubygems/pull/9738) by Muhammad Moussa
22
+
23
+ ### Bug fixes:
24
+
25
+ * Fix `bundle exec` with no arguments for paths containing spaces. Pull request [#9996](https://github.com/ruby/rubygems/pull/9996) by Brandon Weiss
26
+ * Respect enclosing platforms and install_if for gemspec development dependencies. Pull request [#9992](https://github.com/ruby/rubygems/pull/9992) by Hiroshi SHIBATA
27
+ * Respect enclosing group and platforms for gemspec dependencies. Pull request [#9990](https://github.com/ruby/rubygems/pull/9990) by Denis Talakevich
28
+ * Don't report locked gems in the cooldown summary. Pull request [#9981](https://github.com/ruby/rubygems/pull/9981) by Patrik Ragnarsson
29
+ * Make `Bundler::Source::Rubygems#hash` agree with `eql?`. Pull request [#9983](https://github.com/ruby/rubygems/pull/9983) by Hiroshi SHIBATA
30
+ * Add checksums after platform changes in `bundle lock`. Pull request [#9960](https://github.com/ruby/rubygems/pull/9960) by Farid Zakaria
31
+ * Apply BUNDLE_RETRY to lazy gemspec downloads. Pull request [#9868](https://github.com/ruby/rubygems/pull/9868) by Islam Elsayed
32
+ * Fix file locks letting multiple processes in when lock files are removed. Pull request [#9930](https://github.com/ruby/rubygems/pull/9930) by Richard Janita and Hiroshi SHIBATA
33
+
3
34
  ## 4.0.23 / 2026-10-14
4
35
 
5
36
  ### Enhancements:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2026-10-14".freeze
8
- @git_commit_sha = "642a23e".freeze
7
+ @built_at = "2026-11-25".freeze
8
+ @git_commit_sha = "0b572c1".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -24,7 +24,7 @@ module Bundler
24
24
  kernel_load(bin_path, *args)
25
25
  else
26
26
  bin_path = explicit_path(bin_path)
27
- kernel_exec(bin_path, *args)
27
+ kernel_exec([bin_path, bin_path], *args)
28
28
  end
29
29
  else
30
30
  # exec using the given command
@@ -43,7 +43,6 @@ module Bundler
43
43
 
44
44
  Bundler.settings.temporary(frozen: false) do
45
45
  definition = Bundler.definition(update, Bundler.default_lockfile)
46
- definition.add_checksums if options["add-checksums"]
47
46
 
48
47
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
49
48
 
@@ -65,6 +64,11 @@ module Bundler
65
64
  raise InvalidOption, "Removing all platforms from the bundle is not allowed"
66
65
  end
67
66
 
67
+ # Adding checksums resolves the bundle to fetch them, so it has to
68
+ # run after every platform change above has been recorded, or the
69
+ # new platforms are listed in the lockfile without their specs.
70
+ definition.add_checksums if options["add-checksums"]
71
+
68
72
  definition.remotely! unless options[:local]
69
73
 
70
74
  if options["normalize-platforms"]
@@ -303,10 +303,7 @@ module Bundler
303
303
  update_present = active_minor > current_minor if options["filter-minor"]
304
304
 
305
305
  if !update_present && options["filter-patch"] && current_minor == active_minor
306
- current_patch = get_version_semver_portion_value(current_spec, 2)
307
- active_patch = get_version_semver_portion_value(active_spec, 2)
308
-
309
- update_present = active_patch > current_patch
306
+ update_present = active_spec.version > current_spec.version
310
307
  end
311
308
  end
312
309
 
@@ -748,7 +748,9 @@ module Bundler
748
748
  loop do
749
749
  break if incomplete_specs.empty?
750
750
 
751
- Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
751
+ Bundler.ui.debug("The lockfile does not have all gems needed for the current platform (#{Bundler.local_platform}) though, " \
752
+ "Bundler will still re-resolve dependencies. The following locked gems could not be materialized for it: " \
753
+ "#{incomplete_specs.map(&:full_name).join(", ")}")
752
754
  sources.remote!
753
755
  reresolve_without(incomplete_specs)
754
756
  specs = resolve.materialize(dependencies)
@@ -793,10 +795,10 @@ module Bundler
793
795
  @resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
794
796
 
795
797
  @new_platforms.each do |platform|
796
- incomplete_specs = result.incomplete_specs_for_platform(current_dependencies, platform)
798
+ incomplete_specs = result.incomplete_specs_for_platform(dependencies, platform)
797
799
 
798
800
  if incomplete_specs.any?
799
- resolver.raise_incomplete! incomplete_specs
801
+ resolver.raise_incomplete! incomplete_specs, platform
800
802
  end
801
803
  end
802
804
 
@@ -1179,7 +1181,7 @@ module Bundler
1179
1181
  def preload_git_source_worker
1180
1182
  workers = Bundler.settings.installation_parallelization
1181
1183
 
1182
- @preload_git_source_worker ||= Bundler::Worker.new(workers, "Git source preloading", ->(source, _) { source.specs })
1184
+ @preload_git_source_worker ||= Bundler::Worker.new(workers, "Git source preloading", ->(sources, _) { sources.each(&:specs) })
1183
1185
  end
1184
1186
 
1185
1187
  def preload_git_sources
@@ -1190,7 +1192,13 @@ module Bundler
1190
1192
  end
1191
1193
 
1192
1194
  begin
1193
- needed_git_sources.each {|source| preload_git_source_worker.enq(source) }
1195
+ # Sources from the same repository share one cache directory, and
1196
+ # running git in that directory from two workers at once makes the
1197
+ # fetches collide. Preload sources that share a cache in one job, one
1198
+ # after the other, and run the separate caches in parallel.
1199
+ needed_git_sources.group_by(&:cache_path).each_value do |sources|
1200
+ preload_git_source_worker.enq(sources)
1201
+ end
1194
1202
  ensure
1195
1203
  preload_git_source_worker.stop
1196
1204
  end
@@ -106,8 +106,8 @@ module Bundler
106
106
  @expanded_platforms ||= platforms.filter_map {|pl| CurrentRuby::PLATFORM_MAP[pl] }.flatten.uniq
107
107
  end
108
108
 
109
- def should_include?
110
- should_include && current_env? && current_platform?
109
+ def should_include?(platform = nil)
110
+ should_include && current_env? && (platform ? matches_platform?(platform) : current_platform?)
111
111
  end
112
112
 
113
113
  def gemspec_dev_dep?
@@ -147,5 +147,20 @@ module Bundler
147
147
  rescue NoMethodError
148
148
  requirement != ">= 0"
149
149
  end
150
+
151
+ private
152
+
153
+ def matches_platform?(platform)
154
+ return true if platforms.empty?
155
+
156
+ generic = Gem::Platform.generic(platform)
157
+ platforms.any? do |name|
158
+ next false unless [CurrentRuby::PLATFORM_MAP[name]].flatten.include?(generic)
159
+ next Bundler.current_ruby.public_send("#{name}?") if generic == Bundler.generic_local_platform
160
+
161
+ version = name.to_s[/_(\d+)\z/, 1]
162
+ !version || Bundler.current_ruby.public_send("on_#{version}?")
163
+ end
164
+ end
150
165
  end
151
166
  end
data/lib/bundler/dsl.rb CHANGED
@@ -80,11 +80,15 @@ module Bundler
80
80
  @gemspecs << spec
81
81
 
82
82
  path path, "glob" => glob, "name" => spec.name, "gemspec" => spec do
83
- add_dependency spec.name
83
+ options = {}
84
+ normalize_options(spec.name, [], options)
85
+ add_dependency spec.name, nil, options
84
86
  end
85
87
 
86
88
  spec.development_dependencies.each do |dep|
87
- add_dependency dep.name, dep.requirement.as_list, "gemspec_dev_dep" => true, "group" => development_group
89
+ options = {}
90
+ normalize_options(dep.name, dep.requirement.as_list, options)
91
+ add_dependency dep.name, dep.requirement.as_list, options.merge("gemspec_dev_dep" => true, "group" => development_group)
88
92
  end
89
93
  when 0
90
94
  raise InvalidOption, "There are no gemspecs at #{expanded_path}"
@@ -156,7 +156,10 @@ module Bundler
156
156
  elsif cached_spec_path = gemspec_cached_path(spec_file_name)
157
157
  Bundler.load_gemspec(cached_spec_path)
158
158
  else
159
- Bundler.safe_load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
159
+ body = Bundler::Retry.new("fetcher", FAIL_ERRORS).attempts do
160
+ downloader.fetch(uri).body
161
+ end
162
+ Bundler.safe_load_marshal Bundler.rubygems.inflate(body)
160
163
  end
161
164
  raise MarshalError, "is #{spec.inspect}" unless spec.is_a?(Gem::Specification)
162
165
  spec
@@ -41,7 +41,7 @@ module Bundler
41
41
 
42
42
  # resolve to see if the new deps broke anything
43
43
  @definition = builder.to_definition(lockfile_path, {})
44
- @definition.remotely!
44
+ @definition.resolve_remotely!
45
45
 
46
46
  # since nothing broke, we can add those gems to the gemfile
47
47
  append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
@@ -461,6 +461,8 @@ The \fBgemspec\fR method adds any runtime dependencies as gem requirements in th
461
461
  .P
462
462
  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\.
463
463
  .P
464
+ 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\.
465
+ .P
464
466
  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\.
465
467
  .SH "EVAL_GEMFILE"
466
468
  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\.
@@ -546,6 +546,12 @@ options, which control where bundler looks for the `.gemspec`, the glob it uses
546
546
  for the gemspec (defaults to: `{,*,*/*}.gemspec`), what named `.gemspec` it uses
547
547
  (if more than one is present), and which group development dependencies are included in.
548
548
 
549
+ When `gemspec` is called inside a `group` block, the gem requirement on your
550
+ project goes into that group instead of the default group, and so do its runtime
551
+ dependencies. Development dependencies stay in the `development` group, or the
552
+ group given by `:development_group`. An enclosing `platforms` or `install_if`
553
+ block applies to the project and its development dependencies alike.
554
+
549
555
  When a `gemspec` dependency encounters version conflicts during resolution, the
550
556
  local version under development will always be selected -- even if there are
551
557
  remote versions that better match other requirements for the `gemspec` gem.
@@ -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 RuntimeError # Connection failed somehow, again
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.host, mirror.uri.port).map do |address|
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
- value = yield socket, address.to_socket_address, @timeout
198
- socket.close unless socket.closed?
199
- value
199
+ yield socket, address.to_socket_address, @timeout
200
+ ensure
201
+ socket&.close
200
202
  end
201
203
  end
202
204
  end
@@ -163,6 +163,8 @@ module Bundler
163
163
  # @param [Pathname] index file path
164
164
  # @param [Boolean] is the index file global index
165
165
  def load_index(index_file, global = false)
166
+ base = global ? Plugin.global_root : Plugin.root
167
+
166
168
  SharedHelpers.filesystem_access(index_file, :read) do |index_f|
167
169
  valid_file = index_f&.exist? && !index_f.size.zero?
168
170
  break unless valid_file
@@ -170,16 +172,40 @@ module Bundler
170
172
  data = index_f.read
171
173
 
172
174
  require_relative "../yaml_serializer"
173
- index = YAMLSerializer.load(data)
175
+ loaded = YAMLSerializer.load(data)
176
+ # Bundler 4.1 writes empty sections as "{}", which this serializer
177
+ # reads as a string.
178
+ index = %w[commands hooks load_paths plugin_paths sources].to_h do |key|
179
+ [key, loaded[key].is_a?(Hash) ? loaded[key] : {}]
180
+ end
174
181
 
175
182
  @commands.merge!(index["commands"])
176
183
  @hooks.merge!(index["hooks"])
177
- @load_paths.merge!(index["load_paths"])
178
- @plugin_paths.merge!(index["plugin_paths"])
184
+ @load_paths.merge!(absolutize_paths(index["load_paths"], base))
185
+ @plugin_paths.merge!(absolutize_paths(index["plugin_paths"], base))
179
186
  @sources.merge!(index["sources"]) unless global
180
187
  end
181
188
  end
182
189
 
190
+ # Bundler 4.1 records the paths of a plugin installed in the plugin root
191
+ # relative to it.
192
+ def absolutize_paths(paths, base)
193
+ paths.transform_values do |value|
194
+ if value.is_a?(Array)
195
+ value.map {|path| absolutize_path(path, base) }
196
+ else
197
+ absolutize_path(value, base)
198
+ end
199
+ end
200
+ end
201
+
202
+ def absolutize_path(path, base)
203
+ pathname = Pathname.new(path)
204
+ return path if pathname.absolute?
205
+
206
+ Pathname.new(base).join(pathname).to_s
207
+ end
208
+
183
209
  # Should be called when any of the instance variables change. Stores the
184
210
  # instance variables in YAML format. (The instance variables are supposed
185
211
  # to be only String key value pairs)
@@ -137,8 +137,10 @@ module Bundler
137
137
  names_to_allow_remote_specs_for = []
138
138
  extended_explanation = nil
139
139
 
140
+ satisfiers = []
140
141
  while incompatibility.conflict?
141
142
  cause = incompatibility.cause
143
+ satisfiers << cause.satisfier
142
144
  incompatibility = cause.incompatibility
143
145
 
144
146
  incompatibility.terms.each do |term|
@@ -147,7 +149,7 @@ module Bundler
147
149
 
148
150
  if base_requirements[name]
149
151
  names_to_unlock << name
150
- elsif package.ignores_prereleases? && @all_specs[name].any? {|s| s.version.prerelease? }
152
+ elsif filtered_prereleases?(package)
151
153
  names_to_allow_prereleases_for << name
152
154
  elsif package.prefer_local? && @all_specs[name].any? {|s| !s.is_a?(StubSpecification) }
153
155
  names_to_allow_remote_specs_for << name
@@ -160,6 +162,11 @@ module Bundler
160
162
  end
161
163
  end
162
164
 
165
+ # Preserve the usual retry order when it can already resolve the conflict.
166
+ if names_to_unlock.empty? && names_to_allow_prereleases_for.empty? && names_to_allow_remote_specs_for.empty?
167
+ names_to_allow_prereleases_for = prerelease_names_in(satisfiers)
168
+ end
169
+
163
170
  [names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, names_to_allow_remote_specs_for.uniq, extended_explanation]
164
171
  end
165
172
 
@@ -321,8 +328,10 @@ module Bundler
321
328
  "Gemfile"
322
329
  end
323
330
 
324
- def raise_incomplete!(incomplete_specs)
325
- raise_not_found!(@base.get_package(incomplete_specs.first.name))
331
+ def raise_incomplete!(incomplete_specs, platform = nil)
332
+ spec = incomplete_specs.first
333
+ # An unresolved dependency may be missing for a different resolution platform.
334
+ raise_not_found!(@base.get_package(spec.name), spec.version && platform)
326
335
  end
327
336
 
328
337
  def sort_versions_by_preferred(package, versions)
@@ -331,7 +340,7 @@ module Bundler
331
340
 
332
341
  private
333
342
 
334
- def raise_not_found!(package)
343
+ def raise_not_found!(package, platform = nil)
335
344
  name = package.name
336
345
  source = source_for(name)
337
346
  specs = @all_specs[name]
@@ -347,7 +356,7 @@ module Bundler
347
356
  not_found_message = if specs_matching_requirement.any?
348
357
  specs = specs_matching_requirement
349
358
  matching_part = requirement_label
350
- platforms = package.platforms
359
+ platforms = platform ? [platform] : package.platforms
351
360
 
352
361
  if platforms.size == 1
353
362
  "Could not find gem '#{requirement_label}' with platform '#{platforms.first}'"
@@ -414,6 +423,30 @@ module Bundler
414
423
  filter_remote_specs(filter_cooldown(filter_prereleases(specs, package)), package)
415
424
  end
416
425
 
426
+ def prerelease_names_in(incompatibilities)
427
+ seen = {}.compare_by_identity
428
+ packages = []
429
+ while (incompatibility = incompatibilities.pop)
430
+ next if seen[incompatibility]
431
+ seen[incompatibility] = true
432
+
433
+ if incompatibility.conflict?
434
+ cause = incompatibility.cause
435
+ incompatibilities.push(cause.incompatibility, cause.satisfier)
436
+ else
437
+ incompatibility.terms.each {|term| packages << term.package }
438
+ end
439
+ end
440
+
441
+ packages.uniq.filter_map do |package|
442
+ package.name if !base_requirements[package.name] && filtered_prereleases?(package)
443
+ end
444
+ end
445
+
446
+ def filtered_prereleases?(package)
447
+ package.ignores_prereleases? && @all_specs[package.name].any? {|s| s.version.prerelease? }
448
+ end
449
+
417
450
  def filter_prereleases(specs, package)
418
451
  return specs unless package.ignores_prereleases? && specs.size > 1
419
452
 
@@ -499,6 +532,8 @@ module Bundler
499
532
  @cooldown_skipped_specs.each do |(name, version), spec|
500
533
  resolved = resolved_versions[name]
501
534
  next unless resolved && version > resolved
535
+ package = @base.get_package(name)
536
+ next if !package.unlock? && package.locked_version == resolved
502
537
  next unless requirements[name].all? {|req| req.satisfied_by?(version) }
503
538
  newest = newest_skipped[name]
504
539
  newest_skipped[name] = spec if newest.nil? || version > newest.version
@@ -571,6 +606,13 @@ module Bundler
571
606
  versions = versions_for(dep_package, dep_range)
572
607
  end
573
608
 
609
+ if versions.empty? && locked_version_missing?(dep_package)
610
+ @base.unlock_names([name])
611
+ @all_versions.delete(dep_package)
612
+ @sorted_versions.delete(dep_package)
613
+ versions = versions_for(dep_package, dep_range)
614
+ end
615
+
574
616
  if versions.empty? && select_all_versions(dep_package, dep_range).any?
575
617
  raise_all_versions_filtered_out!(dep_package)
576
618
  end
@@ -583,6 +625,16 @@ module Bundler
583
625
  end.to_h
584
626
  end
585
627
 
628
+ def locked_version_missing?(package)
629
+ return false unless package.unlock?
630
+
631
+ name = package.name
632
+ version = package.locked_version
633
+ return false unless base_requirements[name]&.requirements == [[">=", version]]
634
+
635
+ source_for(name).specs.search([name, version]).empty?
636
+ end
637
+
586
638
  def select_all_versions(package, range)
587
639
  range.select_versions(@all_versions[package])
588
640
  end
@@ -42,11 +42,12 @@ module Bundler
42
42
  # Loads the file relative to the dirname of the Gemfile itself.
43
43
  def normalize_ruby_file(filename)
44
44
  file_content = Bundler.read_file(gemfile.dirname.join(filename))
45
- # match "ruby-3.2.2", ruby = "3.2.2", ruby = '3.2.2' or "ruby 3.2.2" capturing version string up to the first space or comment
45
+ # match "ruby-3.2.2", ruby = "3.2.2", ruby = '3.2.2', ruby = { version = "3.2.2" } or "ruby 3.2.2" capturing version string up to the first space or comment
46
46
  version_match = /^ # Start of line
47
47
  ruby # Literal "ruby"
48
48
  [\s-]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
49
49
  (?:=\s*)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50
+ (?:\{[^}]*?\bversion\s*=\s*)? # Optional inline table up to its version key (for ruby = { version = "3.2.2" } format)
50
51
  (?:
51
52
  "([^"]+)" # Double quoted version
52
53
  |
@@ -40,11 +40,22 @@ module Gem
40
40
  end
41
41
  end
42
42
 
43
- def open_file_with_lock(path, &block)
43
+ def open_file_with_lock(path)
44
44
  file_lock = "#{path}.lock"
45
- open_file_with_flock(file_lock, &block)
46
- ensure
47
- FileUtils.rm_f file_lock
45
+
46
+ loop do
47
+ open_file_with_flock(file_lock) do |io|
48
+ # The previous holder removed the file while we were waiting on it,
49
+ # so leave this block and try again on the file now at the lock path
50
+ next unless File.identical?(io, file_lock)
51
+
52
+ begin
53
+ return yield io
54
+ ensure
55
+ FileUtils.rm_f file_lock
56
+ end
57
+ end
58
+ end
48
59
  end
49
60
  end
50
61
  end
@@ -76,7 +76,7 @@ module Bundler
76
76
  end
77
77
 
78
78
  def hash
79
- @remotes.hash
79
+ credless_remotes.hash
80
80
  end
81
81
 
82
82
  def eql?(other)
@@ -140,14 +140,14 @@ module Bundler
140
140
  end
141
141
 
142
142
  def incomplete_for_platform?(deps, platform)
143
+ return false if @specs.empty?
144
+
143
145
  incomplete_specs_for_platform(deps, platform).any?
144
146
  end
145
147
 
146
148
  def incomplete_specs_for_platform(deps, platform)
147
- return [] if @specs.empty?
148
-
149
149
  validation_set = self.class.new(@specs)
150
- validation_set.for(deps, [platform])
150
+ validation_set.for(deps.select {|dep| dep.should_include?(platform) }, [platform])
151
151
  validation_set.incomplete_specs
152
152
  end
153
153
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.23".freeze
4
+ VERSION = "4.0.25".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.23
4
+ version: 4.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko