bundler 2.4.3 → 2.4.7

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -0
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/cli/binstubs.rb +5 -1
  5. data/lib/bundler/cli/init.rb +2 -2
  6. data/lib/bundler/cli.rb +1 -0
  7. data/lib/bundler/current_ruby.rb +2 -0
  8. data/lib/bundler/definition.rb +36 -35
  9. data/lib/bundler/dependency.rb +1 -1
  10. data/lib/bundler/inline.rb +6 -8
  11. data/lib/bundler/installer/parallel_installer.rb +16 -2
  12. data/lib/bundler/installer/standalone.rb +12 -8
  13. data/lib/bundler/installer.rb +3 -7
  14. data/lib/bundler/lazy_specification.rb +8 -3
  15. data/lib/bundler/man/bundle-add.1 +1 -1
  16. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  17. data/lib/bundler/man/bundle-cache.1 +1 -1
  18. data/lib/bundler/man/bundle-check.1 +1 -1
  19. data/lib/bundler/man/bundle-clean.1 +1 -1
  20. data/lib/bundler/man/bundle-config.1 +1 -1
  21. data/lib/bundler/man/bundle-console.1 +1 -1
  22. data/lib/bundler/man/bundle-doctor.1 +1 -1
  23. data/lib/bundler/man/bundle-exec.1 +5 -5
  24. data/lib/bundler/man/bundle-exec.1.ronn +5 -5
  25. data/lib/bundler/man/bundle-gem.1 +1 -1
  26. data/lib/bundler/man/bundle-help.1 +1 -1
  27. data/lib/bundler/man/bundle-info.1 +1 -1
  28. data/lib/bundler/man/bundle-init.1 +5 -1
  29. data/lib/bundler/man/bundle-init.1.ronn +2 -0
  30. data/lib/bundler/man/bundle-inject.1 +1 -1
  31. data/lib/bundler/man/bundle-install.1 +1 -1
  32. data/lib/bundler/man/bundle-list.1 +1 -1
  33. data/lib/bundler/man/bundle-lock.1 +1 -1
  34. data/lib/bundler/man/bundle-open.1 +1 -1
  35. data/lib/bundler/man/bundle-outdated.1 +1 -1
  36. data/lib/bundler/man/bundle-platform.1 +1 -1
  37. data/lib/bundler/man/bundle-plugin.1 +1 -1
  38. data/lib/bundler/man/bundle-pristine.1 +1 -1
  39. data/lib/bundler/man/bundle-remove.1 +1 -1
  40. data/lib/bundler/man/bundle-show.1 +1 -1
  41. data/lib/bundler/man/bundle-update.1 +1 -1
  42. data/lib/bundler/man/bundle-version.1 +1 -1
  43. data/lib/bundler/man/bundle-viz.1 +1 -1
  44. data/lib/bundler/man/bundle.1 +1 -1
  45. data/lib/bundler/man/gemfile.5 +1 -1
  46. data/lib/bundler/resolver/base.rb +38 -7
  47. data/lib/bundler/resolver/candidate.rb +2 -5
  48. data/lib/bundler/resolver/package.rb +11 -2
  49. data/lib/bundler/resolver.rb +61 -43
  50. data/lib/bundler/rubygems_integration.rb +8 -4
  51. data/lib/bundler/shared_helpers.rb +1 -1
  52. data/lib/bundler/source/git/git_proxy.rb +6 -4
  53. data/lib/bundler/source/rubygems.rb +1 -1
  54. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  55. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +6 -2
  56. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +8 -1
  57. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +5 -4
  58. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +4 -2
  59. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +4 -1
  60. data/lib/bundler/version.rb +1 -1
  61. metadata +3 -4
  62. data/lib/bundler/templates/gems.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4598d8531bbdd46221e7238ee2aa828683a3e1854e47bf901857f791a01eb969
4
- data.tar.gz: ead0de0789d8d5682c8d58e60da80a245d5710f8358669e544bb915546f3b82c
3
+ metadata.gz: a65f84ced002f9c1ab71db372d85d37f9578c02a5dc1e454ca62c895e7a4d247
4
+ data.tar.gz: f5e1e1f51f2eaa82029c2129a4c703c75a6e8950370be93cc7bd802d89155bda
5
5
  SHA512:
6
- metadata.gz: 8078880e8f03117e011bedb3150aba2dfc91c271dfd289ed99f0850e5cb8c62c50af5d7c834c2fc224e17ff925f59e237b33141c1b7d9dec3efdaf35b9f353c1
7
- data.tar.gz: 278df46d98c43489e941b788aca7b3cc46358a3ea099987f83c8cdb3b618ed3b0373d7bea590a80620332316d0b12a0bf98f0d02349c55d769174960f5169a45
6
+ metadata.gz: 458454313b85996243c7c77ba6ad6fba40ec2185bf657def24c8bce61595c2bd86f973f465dfcebec1ef01130c5c784dc820710437f62de9701bb6317236b3fb
7
+ data.tar.gz: e35d6b4c930214928c4480df520ef5b342107d1d25da2dbc9596591eab94e115b53c2c4432ff5513630f3d60d18c8935b415bdb2b2bbd60e40d04228b8e2d292
data/CHANGELOG.md CHANGED
@@ -1,3 +1,54 @@
1
+ # 2.4.7 (February 15, 2023)
2
+
3
+ ## Enhancements:
4
+
5
+ - Add `--gemfile` flag to `bundle init` to configure gemfile name to generate [#6046](https://github.com/rubygems/rubygems/pull/6046)
6
+ - Improve solve failure explanations by using better wording [#6366](https://github.com/rubygems/rubygems/pull/6366)
7
+ - Restore better error message when locked ref does not exist [#6356](https://github.com/rubygems/rubygems/pull/6356)
8
+ - Avoid crashing when installing from a corrupted lockfile [#6355](https://github.com/rubygems/rubygems/pull/6355)
9
+ - Improve wording of unmet dependencies warning [#6357](https://github.com/rubygems/rubygems/pull/6357)
10
+ - Add Ruby 3.2 and 3.3 platforms to Gemfile DSL [#6346](https://github.com/rubygems/rubygems/pull/6346)
11
+
12
+ ## Bug fixes:
13
+
14
+ - Fix crash in pub grub involving empty ranges [#6365](https://github.com/rubygems/rubygems/pull/6365)
15
+ - Make gemspec file generated by `bundle gem` properly exclude itself from packaged gem [#6339](https://github.com/rubygems/rubygems/pull/6339)
16
+ - Preserve relative path sources in standalone setup [#6327](https://github.com/rubygems/rubygems/pull/6327)
17
+
18
+ # 2.4.6 (January 31, 2023)
19
+
20
+ ## Enhancements:
21
+
22
+ - Don't warn on `bundle binstubs --standalone --all` [#6312](https://github.com/rubygems/rubygems/pull/6312)
23
+
24
+ ## Bug fixes:
25
+
26
+ - Don't undo require decorations made by other gems [#6308](https://github.com/rubygems/rubygems/pull/6308)
27
+ - Fix `bundler/inline` not properly installing gems with extensions when used more than once [#6306](https://github.com/rubygems/rubygems/pull/6306)
28
+ - Fix `bundler/inline` not skipping installation when gems already there, when used more than once [#6305](https://github.com/rubygems/rubygems/pull/6305)
29
+
30
+ # 2.4.5 (January 21, 2023)
31
+
32
+ ## Bug fixes:
33
+
34
+ - Fix `bundler/inline` not resolving properly if gems not preinstalled [#6282](https://github.com/rubygems/rubygems/pull/6282)
35
+ - Fix packages for external platforms being introduced in lockfile when Bundler retries resolution [#6285](https://github.com/rubygems/rubygems/pull/6285)
36
+
37
+ ## Documentation:
38
+
39
+ - Update bundle-exec man page to not use deprecated `Bundler.with_clean_env` [#6284](https://github.com/rubygems/rubygems/pull/6284)
40
+
41
+ # 2.4.4 (January 16, 2023)
42
+
43
+ ## Bug fixes:
44
+
45
+ - Fix platform specific gems removed from the lockfile [#6266](https://github.com/rubygems/rubygems/pull/6266)
46
+ - Properly handle incompatibilities on platform specific gems [#6270](https://github.com/rubygems/rubygems/pull/6270)
47
+ - Optimistically exclude prereleases from initial resolution [#6246](https://github.com/rubygems/rubygems/pull/6246)
48
+ - Fix another case of not properly falling back to ruby variant when materializing [#6261](https://github.com/rubygems/rubygems/pull/6261)
49
+ - Skip setting `BUNDLER_SETUP` on Ruby 2.6 [#6252](https://github.com/rubygems/rubygems/pull/6252)
50
+ - Let resolver deal with legacy gems with equivalent version and different dependencies [#6219](https://github.com/rubygems/rubygems/pull/6219)
51
+
1
52
  # 2.4.3 (January 6, 2023)
2
53
 
3
54
  ## 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 = "2023-01-06".freeze
8
- @git_commit_sha = "ed1f27f75c".freeze
7
+ @built_at = "2023-02-15".freeze
8
+ @git_commit_sha = "5d717a27e0".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -40,7 +40,11 @@ module Bundler
40
40
  end
41
41
 
42
42
  if options[:standalone]
43
- next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
43
+ if gem_name == "bundler"
44
+ Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") unless options[:all]
45
+ next
46
+ end
47
+
44
48
  Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
45
49
  installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
46
50
  end
@@ -32,7 +32,7 @@ module Bundler
32
32
  file << spec.to_gemfile
33
33
  end
34
34
  else
35
- File.open(File.expand_path("../templates/#{gemfile}", __dir__), "r") do |template|
35
+ File.open(File.expand_path("../templates/Gemfile", __dir__), "r") do |template|
36
36
  File.open(gemfile, "wb") do |destination|
37
37
  IO.copy_stream(template, destination)
38
38
  end
@@ -45,7 +45,7 @@ module Bundler
45
45
  private
46
46
 
47
47
  def gemfile
48
- @gemfile ||= Bundler.preferred_gemfile_name
48
+ @gemfile ||= options[:gemfile] || Bundler.preferred_gemfile_name
49
49
  end
50
50
  end
51
51
  end
data/lib/bundler/cli.rb CHANGED
@@ -156,6 +156,7 @@ module Bundler
156
156
  dependency listed in the gemspec file to the newly created Gemfile.
157
157
  D
158
158
  method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
159
+ method_option "gemfile", :type => :string, :banner => "Use the specified name for the gemfile instead of 'Gemfile'"
159
160
  def init
160
161
  require_relative "cli/init"
161
162
  Init.new(options.dup).run
@@ -22,6 +22,8 @@ module Bundler
22
22
  2.7
23
23
  3.0
24
24
  3.1
25
+ 3.2
26
+ 3.3
25
27
  ].freeze
26
28
 
27
29
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -159,13 +159,6 @@ module Bundler
159
159
  resolve
160
160
  end
161
161
 
162
- def resolve_prefering_local!
163
- @prefer_local = true
164
- @remote = true
165
- sources.remote!
166
- resolve
167
- end
168
-
169
162
  def resolve_with_cache!
170
163
  sources.cached!
171
164
  resolve
@@ -177,6 +170,23 @@ module Bundler
177
170
  resolve
178
171
  end
179
172
 
173
+ def resolution_mode=(options)
174
+ if options["local"]
175
+ @remote = false
176
+ else
177
+ @remote = true
178
+ @prefer_local = options["prefer-local"]
179
+ end
180
+ end
181
+
182
+ def setup_sources_for_resolve
183
+ if @remote == false
184
+ sources.cached!
185
+ else
186
+ sources.remote!
187
+ end
188
+ end
189
+
180
190
  # For given dependency list returns a SpecSet with Gemspec of all the required
181
191
  # dependencies.
182
192
  # 1. The method first resolves the dependencies specified in Gemfile
@@ -473,31 +483,19 @@ module Bundler
473
483
  private
474
484
 
475
485
  def resolver
476
- @resolver ||= begin
477
- last_resolve = converge_locked_specs
478
- remove_ruby_from_platforms_if_necessary!(current_dependencies)
479
- Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve))
480
- end
486
+ @resolver ||= Resolver.new(resolution_packages, gem_version_promoter)
481
487
  end
482
488
 
483
489
  def expanded_dependencies
484
- @expanded_dependencies ||= dependencies + metadata_dependencies
490
+ dependencies + metadata_dependencies
485
491
  end
486
492
 
487
493
  def resolution_packages
488
494
  @resolution_packages ||= begin
489
- packages = Hash.new do |h, k|
490
- h[k] = Resolver::Package.new(k, @platforms, @originally_locked_specs, @unlock[:gems])
491
- end
492
-
493
- expanded_dependencies.each do |dep|
494
- name = dep.name
495
- platforms = dep.gem_platforms(@platforms)
496
-
497
- packages[name] = Resolver::Package.new(name, platforms, @originally_locked_specs, @unlock[:gems], :dependency => dep)
498
- end
499
-
500
- packages
495
+ last_resolve = converge_locked_specs
496
+ remove_ruby_from_platforms_if_necessary!(current_dependencies)
497
+ packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, :locked_specs => @originally_locked_specs, :unlock => @unlock[:gems], :prerelease => gem_version_promoter.pre?)
498
+ additional_base_requirements_for_resolve(packages, last_resolve)
501
499
  end
502
500
  end
503
501
 
@@ -531,13 +529,15 @@ module Bundler
531
529
  break if incomplete_specs.empty?
532
530
 
533
531
  Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
534
- @resolve = start_resolution(:exclude_specs => incomplete_specs)
532
+ setup_sources_for_resolve
533
+ resolution_packages.delete(incomplete_specs)
534
+ @resolve = start_resolution
535
535
  specs = resolve.materialize(dependencies)
536
536
 
537
537
  still_incomplete_specs = specs.incomplete_specs
538
538
 
539
539
  if still_incomplete_specs == incomplete_specs
540
- package = resolution_packages[incomplete_specs.first.name]
540
+ package = resolution_packages.get_package(incomplete_specs.first.name)
541
541
  resolver.raise_not_found! package
542
542
  end
543
543
 
@@ -550,14 +550,14 @@ module Bundler
550
550
  specs
551
551
  end
552
552
 
553
- def start_resolution(exclude_specs: [])
554
- result = resolver.start(expanded_dependencies, resolution_packages, :exclude_specs => exclude_specs)
553
+ def start_resolution
554
+ result = resolver.start
555
555
 
556
556
  SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
557
557
  end
558
558
 
559
559
  def precompute_source_requirements_for_indirect_dependencies?
560
- @remote && sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
560
+ sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
561
561
  end
562
562
 
563
563
  def pin_locally_available_names(source_requirements)
@@ -885,11 +885,12 @@ module Bundler
885
885
  current == proposed
886
886
  end
887
887
 
888
- def additional_base_requirements_for_resolve(last_resolve)
889
- return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
890
- converge_specs(@originally_locked_specs - last_resolve).map do |locked_spec|
891
- Dependency.new(locked_spec.name, ">= #{locked_spec.version}")
892
- end.uniq
888
+ def additional_base_requirements_for_resolve(resolution_packages, last_resolve)
889
+ return resolution_packages unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
890
+ converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
891
+ resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
892
+ end
893
+ resolution_packages
893
894
  end
894
895
 
895
896
  def remove_ruby_from_platforms_if_necessary!(dependencies)
@@ -9,7 +9,7 @@ module Bundler
9
9
  attr_reader :autorequire
10
10
  attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref
11
11
 
12
- ALL_RUBY_VERSIONS = ((18..27).to_a + (30..31).to_a).freeze
12
+ ALL_RUBY_VERSIONS = ((18..27).to_a + (30..33).to_a).freeze
13
13
  PLATFORM_MAP = {
14
14
  :ruby => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
15
15
  :mri => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
@@ -31,6 +31,7 @@
31
31
  #
32
32
  def gemfile(install = false, options = {}, &gemfile)
33
33
  require_relative "../bundler"
34
+ Bundler.reset!
34
35
 
35
36
  opts = options.dup
36
37
  ui = opts.delete(:ui) { Bundler::UI::Shell.new }
@@ -38,9 +39,8 @@ def gemfile(install = false, options = {}, &gemfile)
38
39
  Bundler.ui = ui
39
40
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
40
41
 
41
- begin
42
+ Bundler.with_unbundled_env do
42
43
  Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
43
- old_gemfile = ENV["BUNDLE_GEMFILE"]
44
44
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
45
45
 
46
46
  Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
@@ -65,11 +65,9 @@ def gemfile(install = false, options = {}, &gemfile)
65
65
  runtime = Bundler::Runtime.new(nil, definition)
66
66
  runtime.setup.require
67
67
  end
68
- ensure
69
- if old_gemfile
70
- ENV["BUNDLE_GEMFILE"] = old_gemfile
71
- else
72
- ENV["BUNDLE_GEMFILE"] = ""
73
- end
68
+ end
69
+
70
+ if ENV["BUNDLE_GEMFILE"].nil?
71
+ ENV["BUNDLE_GEMFILE"] = ""
74
72
  end
75
73
  end
@@ -47,6 +47,13 @@ module Bundler
47
47
  dependencies.all? {|d| installed_specs.include? d.name }
48
48
  end
49
49
 
50
+ # Check whether spec's dependencies are missing, which can indicate a
51
+ # corrupted lockfile
52
+ def dependencies_missing?(all_specs)
53
+ spec_names = all_specs.map(&:name)
54
+ dependencies.any? {|d| !spec_names.include? d.name }
55
+ end
56
+
50
57
  # Represents only the non-development dependencies, the ones that are
51
58
  # itself and are in the total list.
52
59
  def dependencies
@@ -110,12 +117,17 @@ module Bundler
110
117
 
111
118
  warning = []
112
119
  warning << "Your lockfile doesn't include a valid resolution."
113
- warning << "You can fix this by regenerating your lockfile or trying to manually editing the bad locked gems to a version that satisfies all dependencies."
120
+ warning << "You can fix this by regenerating your lockfile or manually editing the bad locked gems to a version that satisfies all dependencies."
114
121
  warning << "The unmet dependencies are:"
115
122
 
116
123
  unmet_dependencies.each do |spec, unmet_spec_dependencies|
117
124
  unmet_spec_dependencies.each do |unmet_spec_dependency|
118
- warning << "* #{unmet_spec_dependency}, depended upon #{spec.full_name}, unsatisfied by #{@specs.find {|s| s.name == unmet_spec_dependency.name && !unmet_spec_dependency.matches_spec?(s.spec) }.full_name}"
125
+ found = @specs.find {|s| s.name == unmet_spec_dependency.name && !unmet_spec_dependency.matches_spec?(s.spec) }
126
+ if found
127
+ warning << "* #{unmet_spec_dependency}, dependency of #{spec.full_name}, unsatisfied by #{found.full_name}"
128
+ else
129
+ warning << "* #{unmet_spec_dependency}, dependency of #{spec.full_name} but missing from lockfile"
130
+ end
119
131
  end
120
132
  end
121
133
 
@@ -212,6 +224,8 @@ module Bundler
212
224
  if spec.dependencies_installed? @specs
213
225
  spec.state = :enqueued
214
226
  worker_pool.enq spec
227
+ elsif spec.dependencies_missing? @specs
228
+ spec.state = :failed
215
229
  end
216
230
  end
217
231
  end
@@ -52,7 +52,7 @@ module Bundler
52
52
 
53
53
  def gem_path(path, spec)
54
54
  full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
55
- if spec.source.instance_of?(Source::Path)
55
+ if spec.source.instance_of?(Source::Path) && spec.source.path.absolute?
56
56
  full_path
57
57
  else
58
58
  Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
@@ -84,13 +84,17 @@ module Bundler
84
84
 
85
85
  def reverse_rubygems_kernel_mixin
86
86
  <<~END
87
- kernel = (class << ::Kernel; self; end)
88
- [kernel, ::Kernel].each do |k|
89
- if k.private_method_defined?(:gem_original_require)
90
- private_require = k.private_method_defined?(:require)
91
- k.send(:remove_method, :require)
92
- k.send(:define_method, :require, k.instance_method(:gem_original_require))
93
- k.send(:private, :require) if private_require
87
+ if Gem.respond_to?(:discover_gems_on_require=)
88
+ Gem.discover_gems_on_require = false
89
+ else
90
+ kernel = (class << ::Kernel; self; end)
91
+ [kernel, ::Kernel].each do |k|
92
+ if k.private_method_defined?(:gem_original_require)
93
+ private_require = k.private_method_defined?(:require)
94
+ k.send(:remove_method, :require)
95
+ k.send(:define_method, :require, k.instance_method(:gem_original_require))
96
+ k.send(:private, :require) if private_require
97
+ end
94
98
  end
95
99
  end
96
100
  END
@@ -249,17 +249,13 @@ module Bundler
249
249
 
250
250
  # returns whether or not a re-resolve was needed
251
251
  def resolve_if_needed(options)
252
+ @definition.resolution_mode = options
253
+
252
254
  if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
253
255
  return false if @definition.nothing_changed? && !@definition.missing_specs?
254
256
  end
255
257
 
256
- if options["local"]
257
- @definition.resolve_with_cache!
258
- elsif options["prefer-local"]
259
- @definition.resolve_prefering_local!
260
- else
261
- @definition.resolve_remotely!
262
- end
258
+ @definition.setup_sources_for_resolve
263
259
 
264
260
  true
265
261
  end
@@ -89,7 +89,7 @@ module Bundler
89
89
 
90
90
  installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
91
91
 
92
- specification = __materialize__(installable_candidates)
92
+ specification = __materialize__(installable_candidates, :fallback_to_non_installable => false)
93
93
  return specification unless specification.nil?
94
94
 
95
95
  if target_platform != platform
@@ -102,13 +102,18 @@ module Bundler
102
102
  __materialize__(candidates)
103
103
  end
104
104
 
105
- def __materialize__(candidates)
105
+ # If in frozen mode, we fallback to a non-installable candidate because by
106
+ # doing this we avoid re-resolving and potentially end up changing the
107
+ # lock file, which is not allowed. In that case, we will give a proper error
108
+ # about the mismatch higher up the stack, right before trying to install the
109
+ # bad gem.
110
+ def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
106
111
  search = candidates.reverse.find do |spec|
107
112
  spec.is_a?(StubSpecification) ||
108
113
  (spec.matches_current_ruby? &&
109
114
  spec.matches_current_rubygems?)
110
115
  end
111
- if search.nil? && Bundler.frozen_bundle?
116
+ if search.nil? && fallback_to_non_installable
112
117
  search = candidates.last
113
118
  else
114
119
  search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-ADD" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-ADD" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-BINSTUBS" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-BINSTUBS" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CACHE" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-CACHE" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CHECK" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-CHECK" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CLEAN" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-CLEAN" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CONFIG" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-CONFIG" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-config\fR \- Set bundler configuration options
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CONSOLE" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-CONSOLE" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-console\fR \- Deprecated way to open an IRB session with the bundle pre\-loaded
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-DOCTOR" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-DOCTOR" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-doctor\fR \- Checks the bundle for common problems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-EXEC" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-EXEC" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-exec\fR \- Execute a command in the context of the bundle
@@ -74,13 +74,13 @@ Finally, \fBbundle exec\fR also implicitly modifies \fBGemfile\.lock\fR if the l
74
74
  By default, when attempting to \fBbundle exec\fR to a file with a ruby shebang, Bundler will \fBKernel\.load\fR that file instead of using \fBKernel\.exec\fR\. For the vast majority of cases, this is a performance improvement\. In a rare few cases, this could cause some subtle side\-effects (such as dependence on the exact contents of \fB$0\fR or \fB__FILE__\fR) and the optimization can be disabled by enabling the \fBdisable_exec_load\fR setting\.
75
75
  .
76
76
  .SS "Shelling out"
77
- Any Ruby code that opens a subshell (like \fBsystem\fR, backticks, or \fB%x{}\fR) will automatically use the current Bundler environment\. If you need to shell out to a Ruby command that is not part of your current bundle, use the \fBwith_clean_env\fR method with a block\. Any subshells created inside the block will be given the environment present before Bundler was activated\. For example, Homebrew commands run Ruby, but don\'t work inside a bundle:
77
+ Any Ruby code that opens a subshell (like \fBsystem\fR, backticks, or \fB%x{}\fR) will automatically use the current Bundler environment\. If you need to shell out to a Ruby command that is not part of your current bundle, use the \fBwith_unbundled_env\fR method with a block\. Any subshells created inside the block will be given the environment present before Bundler was activated\. For example, Homebrew commands run Ruby, but don\'t work inside a bundle:
78
78
  .
79
79
  .IP "" 4
80
80
  .
81
81
  .nf
82
82
 
83
- Bundler\.with_clean_env do
83
+ Bundler\.with_unbundled_env do
84
84
  `brew install wget`
85
85
  end
86
86
  .
@@ -89,13 +89,13 @@ end
89
89
  .IP "" 0
90
90
  .
91
91
  .P
92
- Using \fBwith_clean_env\fR is also necessary if you are shelling out to a different bundle\. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use \fBwith_clean_env\fR\.
92
+ Using \fBwith_unbundled_env\fR is also necessary if you are shelling out to a different bundle\. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use \fBwith_unbundled_env\fR\.
93
93
  .
94
94
  .IP "" 4
95
95
  .
96
96
  .nf
97
97
 
98
- Bundler\.with_clean_env do
98
+ Bundler\.with_unbundled_env do
99
99
  Dir\.chdir "/other/bundler/project" do
100
100
  `bundle exec \./script`
101
101
  end
@@ -84,20 +84,20 @@ the `disable_exec_load` setting.
84
84
  Any Ruby code that opens a subshell (like `system`, backticks, or `%x{}`) will
85
85
  automatically use the current Bundler environment. If you need to shell out to
86
86
  a Ruby command that is not part of your current bundle, use the
87
- `with_clean_env` method with a block. Any subshells created inside the block
87
+ `with_unbundled_env` method with a block. Any subshells created inside the block
88
88
  will be given the environment present before Bundler was activated. For
89
89
  example, Homebrew commands run Ruby, but don't work inside a bundle:
90
90
 
91
- Bundler.with_clean_env do
91
+ Bundler.with_unbundled_env do
92
92
  `brew install wget`
93
93
  end
94
94
 
95
- Using `with_clean_env` is also necessary if you are shelling out to a different
95
+ Using `with_unbundled_env` is also necessary if you are shelling out to a different
96
96
  bundle. Any Bundler commands run in a subshell will inherit the current
97
97
  Gemfile, so commands that need to run in the context of a different bundle also
98
- need to use `with_clean_env`.
98
+ need to use `with_unbundled_env`.
99
99
 
100
- Bundler.with_clean_env do
100
+ Bundler.with_unbundled_env do
101
101
  Dir.chdir "/other/bundler/project" do
102
102
  `bundle exec ./script`
103
103
  end
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-GEM" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-GEM" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-HELP" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-HELP" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-help\fR \- Displays detailed help for each subcommand
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INFO" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-INFO" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-info\fR \- Show information for the given gem in your bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INIT" "1" "January 2023" "" ""
4
+ .TH "BUNDLE\-INIT" "1" "February 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-init\fR \- Generates a Gemfile into the current working directory
@@ -18,6 +18,10 @@ Init generates a default [\fBGemfile(5)\fR][Gemfile(5)] in the current working d
18
18
  \fB\-\-gemspec\fR
19
19
  Use the specified \.gemspec to create the [\fBGemfile(5)\fR][Gemfile(5)]
20
20
  .
21
+ .TP
22
+ \fB\-\-gemfile\fR
23
+ Use the specified name for the gemfile instead of \fBGemfile\fR
24
+ .
21
25
  .SH "FILES"
22
26
  Included in the default [\fBGemfile(5)\fR][Gemfile(5)] generated is the line \fB# frozen_string_literal: true\fR\. This is a magic comment supported for the first time in Ruby 2\.3\. The presence of this line results in all string literals in the file being implicitly frozen\.
23
27
  .
@@ -16,6 +16,8 @@ created [`Gemfile(5)`][Gemfile(5)].
16
16
 
17
17
  * `--gemspec`:
18
18
  Use the specified .gemspec to create the [`Gemfile(5)`][Gemfile(5)]
19
+ * `--gemfile`:
20
+ Use the specified name for the gemfile instead of `Gemfile`
19
21
 
20
22
  ## FILES
21
23