From 5d53993a3773e4299277807a8bbcb63aa552bf68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 19 Sep 2024 16:25:49 +0200 Subject: [PATCH] [rubygems/rubygems] Don't try to auto-install dev versions of Bundler not available remotely https://github.com/rubygems/rubygems/commit/1a7a3fdeb9 --- lib/bundler/self_manager.rb | 8 ++++---- spec/bundler/runtime/self_management_spec.rb | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/bundler/self_manager.rb b/lib/bundler/self_manager.rb index ea7c014f3ca9e5..a6d93f20ffb579 100644 --- a/lib/bundler/self_manager.rb +++ b/lib/bundler/self_manager.rb @@ -98,10 +98,10 @@ def restart_with(version) def needs_switching? autoswitching_applies? && - released?(lockfile_version) && - !running?(lockfile_version) && - !updating? && - Bundler.settings[:version] != "system" + Bundler.settings[:version] != "system" && + released?(restart_version) && + !running?(restart_version) && + !updating? end def autoswitching_applies? diff --git a/spec/bundler/runtime/self_management_spec.rb b/spec/bundler/runtime/self_management_spec.rb index 320b7062e89278..c6910e95c005ba 100644 --- a/spec/bundler/runtime/self_management_spec.rb +++ b/spec/bundler/runtime/self_management_spec.rb @@ -176,6 +176,17 @@ expect(out).to eq(Bundler::VERSION[0] == "2" ? "Bundler version #{Bundler::VERSION}" : Bundler::VERSION) end + it "does not try to install when using bundle config version " do + lockfile_bundled_with(previous_minor) + + bundle "config set version #{previous_minor}.dev" + bundle "install" + expect(out).not_to match(/restarting using that version/) + + bundle "-v" + expect(out).to eq(Bundler::VERSION[0] == "2" ? "Bundler version #{Bundler::VERSION}" : Bundler::VERSION) + end + it "ignores malformed lockfile version" do lockfile_bundled_with("2.3.")