Skip to content

Commit

Permalink
[rubygems/rubygems] Don't try to auto-install dev versions of Bundler…
Browse files Browse the repository at this point in the history
… not available remotely

rubygems/rubygems@1a7a3fdeb9
  • Loading branch information
deivid-rodriguez authored and matzbot committed Sep 23, 2024
1 parent d0925c0 commit 5d53993
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/bundler/self_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
11 changes: 11 additions & 0 deletions spec/bundler/runtime/self_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dev-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.")

Expand Down

0 comments on commit 5d53993

Please sign in to comment.