Skip to content

Commit

Permalink
[rubygems/rubygems] Fix bundle update --bundler no longer updating …
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and matzbot committed Dec 27, 2021
1 parent be476f3 commit 95d2e06
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/bundler/self_manager.rb
Expand Up @@ -69,7 +69,12 @@ def needs_switching?
SharedHelpers.in_bundle? &&
lockfile_version &&
!lockfile_version.end_with?(".dev") &&
lockfile_version != current_version
lockfile_version != current_version &&
!updating?
end

def updating?
"update".start_with?(ARGV.first || " ") && ARGV[1..-1].any? {|a| a.start_with?("--bundler") }
end

def installed?
Expand Down
35 changes: 35 additions & 0 deletions spec/bundler/commands/update_spec.rb
Expand Up @@ -1130,6 +1130,41 @@

expect(the_bundle.locked_gems.bundler_version).to eq v(Bundler::VERSION)
end

it "updates the bundler version in the lockfile without re-resolving if the locked version is already installed" do
system_gems "bundler-2.3.3"

build_repo4 do
build_gem "rack", "1.0"
end

install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
gem "rack"
G
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.3")

bundle :update, :bundler => true, :artifice => "vcr", :verbose => true
expect(out).to include("Using bundler #{Bundler::VERSION}")

expect(lockfile).to eq <<~L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
rack (1.0)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
rack
BUNDLED WITH
#{Bundler::VERSION}
L

expect(the_bundle).to include_gem "rack 1.0"
end
end

# these specs are slow and focus on integration and therefore are not exhaustive. unit specs elsewhere handle that.
Expand Down

0 comments on commit 95d2e06

Please sign in to comment.