summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2024-09-18 16:57:02 +0200
committergit <svn-admin@ruby-lang.org>2024-09-20 09:58:24 +0000
commitcf29594c03f7d3d4200ab346d81008b66301be36 (patch)
treef07aad977164f7257c786db80f9b99d5d744c7e1
parentaa2662d5906cb3d7b55b42539b39976f5a32856a (diff)
[rubygems/rubygems] Don't try to install locked bundler when `--local` is passed
https://github.com/rubygems/rubygems/commit/907d46964d
-rw-r--r--lib/bundler/cli/install.rb6
-rw-r--r--spec/bundler/runtime/self_management_spec.rb11
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 038ea246fb..b0b354cf10 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -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?
diff --git a/spec/bundler/runtime/self_management_spec.rb b/spec/bundler/runtime/self_management_spec.rb
index d2472dece2..320b7062e8 100644
--- a/spec/bundler/runtime/self_management_spec.rb
+++ b/spec/bundler/runtime/self_management_spec.rb
@@ -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"