ruby-changes:70626
From: David <ko1@a...>
Date: Tue, 28 Dec 2021 04:38:42 +0900 (JST)
Subject: [ruby-changes:70626] 95d2e06c2b (master): [rubygems/rubygems] Fix `bundle update --bundler` no longer updating lockfile
https://git.ruby-lang.org/ruby.git/commit/?id=95d2e06c2b From 95d2e06c2b465545c8166e5a5edb582ff1d9bcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Sun, 26 Dec 2021 14:42:02 +0100 Subject: [rubygems/rubygems] Fix `bundle update --bundler` no longer updating lockfile https://github.com/rubygems/rubygems/commit/a053b7e4d4 --- lib/bundler/self_manager.rb | 7 ++++++- spec/bundler/commands/update_spec.rb | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/bundler/self_manager.rb b/lib/bundler/self_manager.rb index 2169d814e59..024b2bfbf2d 100644 --- a/lib/bundler/self_manager.rb +++ b/lib/bundler/self_manager.rb @@ -69,7 +69,12 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/self_manager.rb#L69 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? diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index 42cb0f31576..3878c47799a 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -1130,6 +1130,41 @@ RSpec.describe "bundle update --bundler" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/update_spec.rb#L1130 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. -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/