зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] restart with BUNDLE_VERSION if it's specified
https://github.com/rubygems/rubygems/commit/57cfe7cf8d
This commit is contained in:
Родитель
f16c880f77
Коммит
d3305cab44
|
@ -9,26 +9,20 @@ module Bundler
|
|||
def restart_with_locked_bundler_if_needed
|
||||
return unless needs_switching? && installed?
|
||||
|
||||
restart_with(lockfile_version)
|
||||
restart_with(restart_version)
|
||||
end
|
||||
|
||||
def install_locked_bundler_and_restart_with_it_if_needed
|
||||
return unless needs_switching?
|
||||
|
||||
begin
|
||||
# BUNDLE_VERSION=x.y.z
|
||||
restart_version = Gem::Version.new(Bundler.settings[:version])
|
||||
|
||||
if restart_version == lockfile_version
|
||||
Bundler.ui.info \
|
||||
"Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
|
||||
"Installing Bundler #{lockfile_version} and restarting using that version."
|
||||
else
|
||||
Bundler.ui.info \
|
||||
"Bundler #{current_version} is running, but your configuration was #{restart_version}. " \
|
||||
"Installing Bundler #{restart_version} and restarting using that version."
|
||||
rescue ArgumentError
|
||||
# BUNDLE_VERSION=local
|
||||
restart_version = lockfile_version
|
||||
|
||||
Bundler.ui.info \
|
||||
"Bundler #{current_version} is running, but your lockfile was generated with #{restart_version}. " \
|
||||
"Installing Bundler #{restart_version} and restarting using that version."
|
||||
end
|
||||
|
||||
install_and_restart_with(restart_version)
|
||||
|
@ -164,7 +158,7 @@ module Bundler
|
|||
def installed?
|
||||
Bundler.configure
|
||||
|
||||
Bundler.rubygems.find_bundler(lockfile_version.to_s)
|
||||
Bundler.rubygems.find_bundler(restart_version.to_s)
|
||||
end
|
||||
|
||||
def current_version
|
||||
|
@ -177,5 +171,14 @@ module Bundler
|
|||
parsed_version = Bundler::LockfileParser.bundled_with
|
||||
@lockfile_version = parsed_version ? Gem::Version.new(parsed_version) : nil
|
||||
end
|
||||
|
||||
def restart_version
|
||||
return @restart_version if defined?(@restart_version)
|
||||
# BUNDLE_VERSION=x.y.z
|
||||
@restart_version = Gem::Version.new(Bundler.settings[:version])
|
||||
rescue ArgumentError
|
||||
# BUNDLE_VERSION=local
|
||||
@restart_version = lockfile_version
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -109,6 +109,9 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru
|
|||
bundle "config set --local version #{previous_minor}"
|
||||
bundle "install", :artifice => "vcr"
|
||||
expect(out).to include("Bundler #{Bundler::VERSION} is running, but your configuration was #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.")
|
||||
|
||||
bundle "-v"
|
||||
expect(out).to eq(Bundler::VERSION[0] == "2" ? "Bundler version #{previous_minor}" : previous_minor)
|
||||
end
|
||||
|
||||
it "does not try to install when using bundle config version global" do
|
||||
|
|
Загрузка…
Ссылка в новой задаче