rubygems-update 3.5.14 → 3.5.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/bundler/CHANGELOG.md +32 -0
  4. data/bundler/lib/bundler/build_metadata.rb +2 -2
  5. data/bundler/lib/bundler/cli/gem.rb +7 -14
  6. data/bundler/lib/bundler/cli.rb +3 -0
  7. data/bundler/lib/bundler/definition.rb +37 -25
  8. data/bundler/lib/bundler/env.rb +1 -1
  9. data/bundler/lib/bundler/gem_helpers.rb +14 -7
  10. data/bundler/lib/bundler/injector.rb +1 -4
  11. data/bundler/lib/bundler/installer/standalone.rb +0 -3
  12. data/bundler/lib/bundler/installer.rb +1 -3
  13. data/bundler/lib/bundler/lazy_specification.rb +1 -0
  14. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  15. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  16. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  17. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  18. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  19. data/bundler/lib/bundler/man/bundle-config.1 +1 -1
  20. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  21. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  22. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  23. data/bundler/lib/bundler/man/bundle-gem.1 +7 -1
  24. data/bundler/lib/bundler/man/bundle-gem.1.ronn +11 -0
  25. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  26. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  27. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  28. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  29. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle.1 +1 -1
  43. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  44. data/bundler/lib/bundler/resolver/base.rb +4 -0
  45. data/bundler/lib/bundler/resolver/candidate.rb +4 -16
  46. data/bundler/lib/bundler/resolver/package.rb +4 -0
  47. data/bundler/lib/bundler/resolver/spec_group.rb +20 -2
  48. data/bundler/lib/bundler/resolver.rb +18 -9
  49. data/bundler/lib/bundler/rubygems_ext.rb +69 -1
  50. data/bundler/lib/bundler/rubygems_gem_installer.rb +31 -1
  51. data/bundler/lib/bundler/rubygems_integration.rb +2 -2
  52. data/bundler/lib/bundler/runtime.rb +1 -1
  53. data/bundler/lib/bundler/self_manager.rb +17 -2
  54. data/bundler/lib/bundler/source/rubygems.rb +1 -0
  55. data/bundler/lib/bundler/spec_set.rb +14 -12
  56. data/bundler/lib/bundler/stub_specification.rb +8 -0
  57. data/bundler/lib/bundler/vendored_net_http.rb +17 -6
  58. data/bundler/lib/bundler/version.rb +1 -1
  59. data/lib/rubygems/config_file.rb +13 -8
  60. data/lib/rubygems/installer.rb +8 -7
  61. data/lib/rubygems/platform.rb +2 -2
  62. data/lib/rubygems/specification.rb +9 -5
  63. data/lib/rubygems/specification_policy.rb +14 -4
  64. data/lib/rubygems.rb +20 -14
  65. data/rubygems-update.gemspec +1 -1
  66. metadata +3 -3
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-OPEN" "1" "May 2024" ""
3
+ .TH "BUNDLE\-OPEN" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-OUTDATED" "1" "May 2024" ""
3
+ .TH "BUNDLE\-OUTDATED" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-outdated\fR \- List installed gems with newer versions available
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PLATFORM" "1" "May 2024" ""
3
+ .TH "BUNDLE\-PLATFORM" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-platform\fR \- Displays platform compatibility information
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PLUGIN" "1" "May 2024" ""
3
+ .TH "BUNDLE\-PLUGIN" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-plugin\fR \- Manage Bundler plugins
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PRISTINE" "1" "May 2024" ""
3
+ .TH "BUNDLE\-PRISTINE" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-REMOVE" "1" "May 2024" ""
3
+ .TH "BUNDLE\-REMOVE" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-SHOW" "1" "May 2024" ""
3
+ .TH "BUNDLE\-SHOW" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-UPDATE" "1" "May 2024" ""
3
+ .TH "BUNDLE\-UPDATE" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-update\fR \- Update your gems to the latest available versions
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VERSION" "1" "May 2024" ""
3
+ .TH "BUNDLE\-VERSION" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-version\fR \- Prints Bundler version information
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VIZ" "1" "May 2024" ""
3
+ .TH "BUNDLE\-VIZ" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE" "1" "May 2024" ""
3
+ .TH "BUNDLE" "1" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\fR \- Ruby Dependency Management
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "GEMFILE" "5" "May 2024" ""
3
+ .TH "GEMFILE" "5" "June 2024" ""
4
4
  .SH "NAME"
5
5
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
6
6
  .SH "SYNOPSIS"
@@ -30,6 +30,10 @@ module Bundler
30
30
  end.compact
31
31
  end
32
32
 
33
+ def specs_compatible_with(result)
34
+ @base.specs_compatible_with(result)
35
+ end
36
+
33
37
  def [](name)
34
38
  @base[name]
35
39
  end
@@ -24,10 +24,10 @@ module Bundler
24
24
 
25
25
  attr_reader :version
26
26
 
27
- def initialize(version, specs: [])
28
- @spec_group = Resolver::SpecGroup.new(specs)
27
+ def initialize(version, group: nil, priority: -1)
28
+ @spec_group = group || SpecGroup.new([])
29
29
  @version = Gem::Version.new(version)
30
- @ruby_only = specs.map(&:platform).uniq == [Gem::Platform::RUBY]
30
+ @priority = priority
31
31
  end
32
32
 
33
33
  def dependencies
@@ -40,18 +40,6 @@ module Bundler
40
40
  @spec_group.to_specs(package.force_ruby_platform?)
41
41
  end
42
42
 
43
- def generic!
44
- @ruby_only = true
45
-
46
- self
47
- end
48
-
49
- def platform_specific!
50
- @ruby_only = false
51
-
52
- self
53
- end
54
-
55
43
  def prerelease?
56
44
  @version.prerelease?
57
45
  end
@@ -61,7 +49,7 @@ module Bundler
61
49
  end
62
50
 
63
51
  def sort_obj
64
- [@version, @ruby_only ? -1 : 1]
52
+ [@version, @priority]
65
53
  end
66
54
 
67
55
  def <=>(other)
@@ -25,6 +25,10 @@ module Bundler
25
25
  @prerelease = @dependency.prerelease? || @locked_version&.prerelease? || prerelease ? :consider_first : :ignore
26
26
  end
27
27
 
28
+ def platform_specs(specs)
29
+ platforms.map {|platform| GemHelpers.select_best_platform_match(specs, platform, prefer_locked: !unlock?) }
30
+ end
31
+
28
32
  def to_s
29
33
  @name.delete("\0")
30
34
  end
@@ -3,6 +3,8 @@
3
3
  module Bundler
4
4
  class Resolver
5
5
  class SpecGroup
6
+ attr_reader :specs
7
+
6
8
  def initialize(specs)
7
9
  @specs = specs
8
10
  end
@@ -38,17 +40,33 @@ module Bundler
38
40
  def dependencies
39
41
  @dependencies ||= @specs.map do |spec|
40
42
  __dependencies(spec) + metadata_dependencies(spec)
41
- end.flatten.uniq
43
+ end.flatten.uniq.sort
44
+ end
45
+
46
+ def ==(other)
47
+ sorted_spec_names == other.sorted_spec_names
48
+ end
49
+
50
+ def merge(other)
51
+ return false unless equivalent?(other)
52
+
53
+ @specs |= other.specs
54
+
55
+ true
42
56
  end
43
57
 
44
58
  protected
45
59
 
46
60
  def sorted_spec_names
47
- @sorted_spec_names ||= @specs.map(&:full_name).sort
61
+ @specs.map(&:full_name).sort
48
62
  end
49
63
 
50
64
  private
51
65
 
66
+ def equivalent?(other)
67
+ name == other.name && version == other.version && source == other.source && dependencies == other.dependencies
68
+ end
69
+
52
70
  def exemplary_spec
53
71
  @specs.first
54
72
  end
@@ -79,7 +79,8 @@ module Bundler
79
79
  def solve_versions(root:, logger:)
80
80
  solver = PubGrub::VersionSolver.new(source: self, root: root, logger: logger)
81
81
  result = solver.solve
82
- result.map {|package, version| version.to_specs(package) }.flatten.uniq
82
+ resolved_specs = result.map {|package, version| version.to_specs(package) }.flatten
83
+ resolved_specs |= @base.specs_compatible_with(SpecSet.new(resolved_specs))
83
84
  rescue PubGrub::SolveFailure => e
84
85
  incompatibility = e.incompatibility
85
86
 
@@ -254,7 +255,7 @@ module Bundler
254
255
  results = filter_matching_specs(results, locked_requirement) if locked_requirement
255
256
 
256
257
  results.group_by(&:version).reduce([]) do |groups, (version, specs)|
257
- platform_specs = package.platforms.map {|platform| select_best_platform_match(specs, platform) }
258
+ platform_specs = package.platform_specs(specs)
258
259
 
259
260
  # If package is a top-level dependency,
260
261
  # candidate is only valid if there are matching versions for all resolution platforms.
@@ -269,14 +270,22 @@ module Bundler
269
270
  next groups if platform_specs.all?(&:empty?)
270
271
  end
271
272
 
272
- platform_specs.flatten!
273
-
274
273
  ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
275
- groups << Resolver::Candidate.new(version, specs: ruby_specs) if ruby_specs.any?
274
+ ruby_group = Resolver::SpecGroup.new(ruby_specs)
275
+
276
+ unless ruby_group.empty?
277
+ platform_specs.each do |specs|
278
+ ruby_group.merge(Resolver::SpecGroup.new(specs))
279
+ end
280
+
281
+ groups << Resolver::Candidate.new(version, group: ruby_group, priority: -1)
282
+ next groups if package.force_ruby_platform?
283
+ end
276
284
 
277
- next groups if platform_specs == ruby_specs || package.force_ruby_platform?
285
+ platform_group = Resolver::SpecGroup.new(platform_specs.flatten.uniq)
286
+ next groups if platform_group == ruby_group
278
287
 
279
- groups << Resolver::Candidate.new(version, specs: platform_specs)
288
+ groups << Resolver::Candidate.new(version, group: platform_group, priority: 1)
280
289
 
281
290
  groups
282
291
  end
@@ -431,8 +440,8 @@ module Bundler
431
440
 
432
441
  def requirement_to_range(requirement)
433
442
  ranges = requirement.requirements.map do |(op, version)|
434
- ver = Resolver::Candidate.new(version).generic!
435
- platform_ver = Resolver::Candidate.new(version).platform_specific!
443
+ ver = Resolver::Candidate.new(version, priority: -1)
444
+ platform_ver = Resolver::Candidate.new(version, priority: 1)
436
445
 
437
446
  case op
438
447
  when "~>"
@@ -30,9 +30,42 @@ module Gem
30
30
  end
31
31
  end
32
32
 
33
+ # Can be removed once RubyGems 3.5.14 support is dropped
34
+ unless Gem.respond_to?(:open_file_with_flock)
35
+ def self.open_file_with_flock(path, &block)
36
+ flags = File.exist?(path) ? "r+" : "a+"
37
+
38
+ File.open(path, flags) do |io|
39
+ begin
40
+ io.flock(File::LOCK_EX)
41
+ rescue Errno::ENOSYS, Errno::ENOTSUP
42
+ end
43
+ yield io
44
+ rescue Errno::ENOLCK # NFS
45
+ if Thread.main != Thread.current
46
+ raise
47
+ else
48
+ File.open(path, flags, &block)
49
+ end
50
+ end
51
+ end
52
+ end
53
+
33
54
  require "rubygems/specification"
34
55
 
56
+ # Can be removed once RubyGems 3.5.14 support is dropped
57
+ VALIDATES_FOR_RESOLUTION = Specification.new.respond_to?(:validate_for_resolution).freeze
58
+
59
+ # Can be removed once RubyGems 3.3.15 support is dropped
60
+ FLATTENS_REQUIRED_PATHS = Specification.new.respond_to?(:flatten_require_paths).freeze
61
+
35
62
  class Specification
63
+ # Can be removed once RubyGems 3.5.15 support is dropped
64
+ correct_array_attributes = @@default_value.select {|_k,v| v.is_a?(Array) }.keys
65
+ unless @@array_attributes == correct_array_attributes
66
+ @@array_attributes = correct_array_attributes # rubocop:disable Style/ClassVars
67
+ end
68
+
36
69
  require_relative "match_metadata"
37
70
  require_relative "match_platform"
38
71
 
@@ -131,6 +164,33 @@ module Gem
131
164
  !default_gem? && !File.directory?(full_gem_path)
132
165
  end
133
166
 
167
+ unless VALIDATES_FOR_RESOLUTION
168
+ def validate_for_resolution
169
+ SpecificationPolicy.new(self).validate_for_resolution
170
+ end
171
+ end
172
+
173
+ unless FLATTENS_REQUIRED_PATHS
174
+ def flatten_require_paths
175
+ return unless raw_require_paths.first.is_a?(Array)
176
+
177
+ warn "#{name} #{version} includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this"
178
+ raw_require_paths.flatten!
179
+ end
180
+
181
+ class << self
182
+ module RequirePathFlattener
183
+ def from_yaml(input)
184
+ spec = super(input)
185
+ spec.flatten_require_paths
186
+ spec
187
+ end
188
+ end
189
+
190
+ prepend RequirePathFlattener
191
+ end
192
+ end
193
+
134
194
  private
135
195
 
136
196
  def dependencies_to_gemfile(dependencies, group = nil)
@@ -150,6 +210,14 @@ module Gem
150
210
  end
151
211
  end
152
212
 
213
+ unless VALIDATES_FOR_RESOLUTION
214
+ class SpecificationPolicy
215
+ def validate_for_resolution
216
+ validate_required!
217
+ end
218
+ end
219
+ end
220
+
153
221
  module BetterPermissionError
154
222
  def data
155
223
  super
@@ -241,7 +309,7 @@ module Gem
241
309
 
242
310
  # cpu
243
311
  ([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
244
- (@cpu == "arm" && other.cpu.start_with?("arm"))) &&
312
+ (@cpu == "arm" && other.cpu.start_with?("armv"))) &&
245
313
 
246
314
  # os
247
315
  @os == other.os &&
@@ -48,7 +48,17 @@ module Bundler
48
48
  spec
49
49
  end
50
50
 
51
- def pre_install_checks
51
+ if Bundler.rubygems.provides?("< 3.5")
52
+ def pre_install_checks
53
+ super
54
+ rescue Gem::FilePermissionError
55
+ # Ignore permission checks in RubyGems. Instead, go on, and try to write
56
+ # for real. We properly handle permission errors when they happen.
57
+ nil
58
+ end
59
+ end
60
+
61
+ def ensure_writable_dir(dir)
52
62
  super
53
63
  rescue Gem::FilePermissionError
54
64
  # Ignore permission checks in RubyGems. Instead, go on, and try to write
@@ -71,6 +81,26 @@ module Bundler
71
81
  end
72
82
  end
73
83
 
84
+ if Bundler.rubygems.provides?("< 3.5.15")
85
+ def generate_bin_script(filename, bindir)
86
+ bin_script_path = File.join bindir, formatted_program_filename(filename)
87
+
88
+ Gem.open_file_with_flock("#{bin_script_path}.lock") do
89
+ require "fileutils"
90
+ FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
91
+
92
+ File.open(bin_script_path, "wb", 0o755) do |file|
93
+ file.write app_script_text(filename)
94
+ file.chmod(options[:prog_mode] || 0o755)
95
+ end
96
+ end
97
+
98
+ verbose bin_script_path
99
+
100
+ generate_windows_script filename, bindir
101
+ end
102
+ end
103
+
74
104
  def build_extensions
75
105
  extension_cache_path = options[:bundler_extension_cache_path]
76
106
  extension_dir = spec.extension_dir
@@ -48,7 +48,7 @@ module Bundler
48
48
  end
49
49
 
50
50
  def validate(spec)
51
- Bundler.ui.silence { spec.validate(false) }
51
+ Bundler.ui.silence { spec.validate_for_resolution }
52
52
  rescue Gem::InvalidSpecificationException => e
53
53
  error_message = "The gemspec at #{spec.loaded_from} is not valid. Please fix this gemspec.\n" \
54
54
  "The validation error was '#{e.message}'\n"
@@ -204,7 +204,7 @@ module Bundler
204
204
 
205
205
  [::Kernel.singleton_class, ::Kernel].each do |kernel_class|
206
206
  redefine_method(kernel_class, :gem) do |dep, *reqs|
207
- if executables&.include?(File.basename(caller.first.split(":").first))
207
+ if executables&.include?(File.basename(caller_locations(1, 1).first.path))
208
208
  break
209
209
  end
210
210
 
@@ -10,7 +10,7 @@ module Bundler
10
10
  end
11
11
 
12
12
  def setup(*groups)
13
- @definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen_bundle?
13
+ @definition.ensure_equivalent_gemfile_and_lockfile
14
14
 
15
15
  # Has to happen first
16
16
  clean_load_path
@@ -70,8 +70,23 @@ module Bundler
70
70
  configured_gem_home = ENV["GEM_HOME"]
71
71
  configured_gem_path = ENV["GEM_PATH"]
72
72
 
73
- cmd = [$PROGRAM_NAME, *ARGV]
74
- cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
73
+ # Bundler specs need some stuff to be required before Bundler starts
74
+ # running, for example, for faking the compact index API. However, these
75
+ # flags are lost when we reexec to a different version of Bundler. In the
76
+ # future, we may be able to properly reconstruct the original Ruby
77
+ # invocation (see https://bugs.ruby-lang.org/issues/6648), but for now
78
+ # there's no way to do it, so we need to be explicit about how to re-exec.
79
+ # This may be a feature end users request at some point, but maybe by that
80
+ # time, we have builtin tools to do. So for now, we use an undocumented
81
+ # ENV variable only for our specs.
82
+ bundler_spec_original_cmd = ENV["BUNDLER_SPEC_ORIGINAL_CMD"]
83
+ if bundler_spec_original_cmd
84
+ require "shellwords"
85
+ cmd = [*Shellwords.shellsplit(bundler_spec_original_cmd), *ARGV]
86
+ else
87
+ cmd = [$PROGRAM_NAME, *ARGV]
88
+ cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
89
+ end
75
90
 
76
91
  Bundler.with_original_env do
77
92
  Kernel.exec(
@@ -206,6 +206,7 @@ module Bundler
206
206
 
207
207
  spec.full_gem_path = installed_spec.full_gem_path
208
208
  spec.loaded_from = installed_spec.loaded_from
209
+ spec.base_dir = installed_spec.base_dir
209
210
 
210
211
  spec.post_install_message
211
212
  end
@@ -71,12 +71,6 @@ module Bundler
71
71
  platforms
72
72
  end
73
73
 
74
- def complete_platforms!(platforms)
75
- platforms.each do |platform|
76
- complete_platform(platform)
77
- end
78
- end
79
-
80
74
  def validate_deps(s)
81
75
  s.runtime_dependencies.each do |dep|
82
76
  next if dep.name == "bundler"
@@ -158,6 +152,12 @@ module Bundler
158
152
  @specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
159
153
  end
160
154
 
155
+ def specs_compatible_with(other)
156
+ select do |spec|
157
+ other.valid?(spec)
158
+ end
159
+ end
160
+
161
161
  def delete_by_name(name)
162
162
  @specs.reject! {|spec| spec.name == name }
163
163
 
@@ -195,6 +195,10 @@ module Bundler
195
195
  lookup.keys
196
196
  end
197
197
 
198
+ def valid?(s)
199
+ s.matches_current_metadata? && valid_dependencies?(s)
200
+ end
201
+
198
202
  private
199
203
 
200
204
  def reset!
@@ -209,7 +213,7 @@ module Bundler
209
213
  spec = specs.first
210
214
  matching_specs = spec.source.specs.search([spec.name, spec.version])
211
215
  platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find do |s|
212
- s.matches_current_metadata? && valid_dependencies?(s)
216
+ valid?(s)
213
217
  end
214
218
 
215
219
  if platform_spec
@@ -273,13 +277,11 @@ module Bundler
273
277
  specs_for_name = lookup[dep.name]
274
278
  return [] unless specs_for_name
275
279
 
276
- matching_specs = if dep.force_ruby_platform
277
- GemHelpers.force_ruby_platform(specs_for_name)
280
+ if platform
281
+ GemHelpers.select_best_platform_match(specs_for_name, platform, force_ruby: dep.force_ruby_platform)
278
282
  else
279
- GemHelpers.select_best_platform_match(specs_for_name, platform || Bundler.local_platform)
283
+ GemHelpers.select_best_local_platform_match(specs_for_name, force_ruby: dep.force_ruby_platform)
280
284
  end
281
- matching_specs.map!(&:materialize_for_installation).compact! if platform.nil?
282
- matching_specs
283
285
  end
284
286
 
285
287
  def tsort_each_child(s)
@@ -77,6 +77,14 @@ module Bundler
77
77
  stub.full_require_paths
78
78
  end
79
79
 
80
+ def require_paths
81
+ stub.require_paths
82
+ end
83
+
84
+ def base_dir=(path)
85
+ stub.base_dir = path
86
+ end
87
+
80
88
  def load_paths
81
89
  full_require_paths
82
90
  end
@@ -1,12 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- begin
4
- require "rubygems/vendored_net_http"
5
- rescue LoadError
3
+ # This defined? guard can be removed once RubyGems 3.4 support is dropped.
4
+ #
5
+ # Bundler specs load this code from `spec/support/vendored_net_http.rb` to avoid
6
+ # activating the Bundler gem too early. Without this guard, we get redefinition
7
+ # warnings once Bundler is actually activated and
8
+ # `lib/bundler/vendored_net_http.rb` is required. This is not an issue in
9
+ # RubyGems versions including `rubygems/vendored_net_http` since `require` takes
10
+ # care of avoiding the double load.
11
+ #
12
+ unless defined?(Gem::Net)
6
13
  begin
7
- require "rubygems/net/http"
14
+ require "rubygems/vendored_net_http"
8
15
  rescue LoadError
9
- require "net/http"
10
- Gem::Net = Net
16
+ begin
17
+ require "rubygems/net/http"
18
+ rescue LoadError
19
+ require "net/http"
20
+ Gem::Net = Net
21
+ end
11
22
  end
12
23
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.14".freeze
4
+ VERSION = "2.5.16".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -510,12 +510,12 @@ if you believe they were disclosed to a third party.
510
510
 
511
511
  # Return the configuration information for +key+.
512
512
  def [](key)
513
- @hash[key.to_s]
513
+ @hash[key] || @hash[key.to_s]
514
514
  end
515
515
 
516
516
  # Set configuration option +key+ to +value+.
517
517
  def []=(key, value)
518
- @hash[key.to_s] = value
518
+ @hash[key] = value
519
519
  end
520
520
 
521
521
  def ==(other) # :nodoc:
@@ -543,8 +543,13 @@ if you believe they were disclosed to a third party.
543
543
  require_relative "yaml_serializer"
544
544
 
545
545
  content = Gem::YAMLSerializer.load(yaml)
546
+ deep_transform_config_keys!(content)
547
+ end
546
548
 
547
- content.transform_keys! do |k|
549
+ private
550
+
551
+ def self.deep_transform_config_keys!(config)
552
+ config.transform_keys! do |k|
548
553
  if k.match?(/\A:(.*)\Z/)
549
554
  k[1..-1].to_sym
550
555
  elsif k.include?("__") || k.match?(%r{/\Z})
@@ -558,7 +563,7 @@ if you believe they were disclosed to a third party.
558
563
  end
559
564
  end
560
565
 
561
- content.transform_values! do |v|
566
+ config.transform_values! do |v|
562
567
  if v.is_a?(String)
563
568
  if v.match?(/\A:(.*)\Z/)
564
569
  v[1..-1].to_sym
@@ -571,18 +576,18 @@ if you believe they were disclosed to a third party.
571
576
  else
572
577
  v
573
578
  end
574
- elsif v.is_a?(Hash) && v.empty?
579
+ elsif v.empty?
575
580
  nil
581
+ elsif v.is_a?(Hash)
582
+ deep_transform_config_keys!(v)
576
583
  else
577
584
  v
578
585
  end
579
586
  end
580
587
 
581
- content
588
+ config
582
589
  end
583
590
 
584
- private
585
-
586
591
  def set_config_file_name(args)
587
592
  @config_file_name = ENV["GEMRC"]
588
593
  need_config_file_name = false