[rubygems/rubygems] Don't try to install locked bundler when --local is passed

https://github.com/rubygems/rubygems/commit/907d46964d
This commit is contained in:
David Rodríguez 2024-09-18 16:57:02 +02:00 committed by git
parent aa2662d590
commit cf29594c03
2 changed files with 16 additions and 1 deletions

View File

@ -12,7 +12,11 @@ module Bundler
warn_if_root
Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
if options[:local]
Bundler.self_manager.restart_with_locked_bundler_if_needed
else
Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
end
Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Gem.freebsd_platform?

View File

@ -131,6 +131,17 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev" do
expect(out).to eq(Bundler::VERSION[0] == "2" ? "Bundler version #{Bundler::VERSION}" : Bundler::VERSION)
end
it "does not try to install when --local is passed" do
lockfile_bundled_with(previous_minor)
system_gems "myrack-1.0.0", path: default_bundle_path
bundle "install --local"
expect(out).not_to match(/Installing Bundler/)
bundle "-v"
expect(out).to eq(Bundler::VERSION[0] == "2" ? "Bundler version #{Bundler::VERSION}" : Bundler::VERSION)
end
it "shows a discrete message if locked bundler does not exist" do
missing_minor = "#{Bundler::VERSION[0]}.999.999"