[rubygems/rubygems] Remove BUNDLER_IGNORE_DEFAULT_GEM

As long as we use a high enough test version, the default version of
Bundler should never get in the middle.

https://github.com/rubygems/rubygems/commit/d63f0818aa
This commit is contained in:
David Rodríguez 2024-09-13 12:16:39 +02:00 committed by git
parent 642528511e
commit 36b2fea691
3 changed files with 13 additions and 28 deletions

View File

@ -1541,26 +1541,29 @@ RSpec.describe "bundle update --bundler" do
end
it "does not update the bundler version in the lockfile if the latest version is not compatible with current ruby", :ruby_repo do
pristine_system_gems "bundler-2.3.9"
pristine_system_gems "bundler-9.9.9"
build_repo4 do
build_gem "myrack", "1.0"
build_bundler "2.3.9"
build_bundler "9.9.9"
build_bundler "999.0.0" do |s|
s.required_ruby_version = "> #{Gem.ruby_version}"
end
end
install_gemfile <<-G, env: { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" }
checksums = checksums_section do |c|
c.checksum(gem_repo4, "myrack", "1.0")
end
install_gemfile <<-G
source "https://gem.repo4"
gem "myrack"
G
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9")
bundle :update, bundler: true, artifice: "compact_index", verbose: true, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "BUNDLER_IGNORE_DEFAULT_GEM" => "true" }
bundle :update, bundler: true, artifice: "compact_index", verbose: true, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
expect(out).to include("Using bundler 2.3.9")
expect(out).to include("Using bundler 9.9.9")
expect(lockfile).to eq <<~L
GEM
@ -1573,12 +1576,12 @@ RSpec.describe "bundle update --bundler" do
DEPENDENCIES
myrack
#{checksums}
BUNDLED WITH
2.3.9
9.9.9
L
expect(the_bundle).to include_gems "bundler 2.3.9"
expect(the_bundle).to include_gems "bundler 9.9.9"
expect(the_bundle).to include_gems "myrack 1.0"
end

View File

@ -36,18 +36,4 @@ module Gem
if ENV["BUNDLER_SPEC_GEM_SOURCES"]
self.sources = [ENV["BUNDLER_SPEC_GEM_SOURCES"]]
end
if ENV["BUNDLER_IGNORE_DEFAULT_GEM"]
module RemoveDefaultBundlerStub
def default_stubs(pattern = "*")
super.delete_if {|stub| stub.name == "bundler" }
end
end
class Specification
class << self
prepend RemoveDefaultBundlerStub
end
end
end
end

View File

@ -170,12 +170,8 @@ module Spec
requires << "#{Path.spec_dir}/support/artifice/#{artifice}.rb"
end
hax_path = "#{Path.spec_dir}/support/hax.rb"
requires << "#{Path.spec_dir}/support/hax.rb"
# For specs that need to ignore the default Bundler gem, load hax before
# anything else since other stuff may actually load bundler and not skip
# the default version
env.include?("BUNDLER_IGNORE_DEFAULT_GEM") ? requires.prepend(hax_path) : requires.append(hax_path)
require_option = requires.map {|r| "-r#{r}" }
[env, [Gem.ruby, *lib_option, *require_option].compact.join(" ")]