[rubygems/rubygems] Better approach to falling back to user installation when GEM_HOME not writable

f67bced16b
This commit is contained in:
David Rodríguez 2023-12-01 12:53:43 +01:00 committed by Hiroshi SHIBATA
parent 0f3f907e17
commit 33bd956257
6 changed files with 29 additions and 128 deletions

View file

@ -22,15 +22,6 @@ class Gem::Command
Gem::OptionParser.accept Symbol, &:to_sym
##
# Names of commands that should print "Defaulting to user installation"
# warning.
COMMANDS_WITH_AUTO_INSTALL_DIR_WARNING = [
"install",
"update",
].freeze
##
# The name of the command.
@ -332,11 +323,6 @@ class Gem::Command
elsif @when_invoked
@when_invoked.call options
else
if COMMANDS_WITH_AUTO_INSTALL_DIR_WARNING.include?(@command) && \
Gem.paths.auto_user_install && !options[:install_dir] && !options[:user_install]
self.ui.say "Defaulting to user installation because default installation directory (#{Gem.default_dir}) is not writable."
end
execute
end
ensure