aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEllen Marie Dash <me@duckie.co>2023-11-29 18:49:08 -0500
committergit <svn-admin@ruby-lang.org>2023-11-30 19:58:40 +0000
commit7008d97b76649928cd5552eb0f44a496d468daf0 (patch)
tree5dfe0a5e2ab0ccd82c9da6302ab58200706cff06 /lib
parent060f14bf62ad3f426a6666901c45b82d4334fa26 (diff)
downloadruby-7008d97b76649928cd5552eb0f44a496d468daf0.tar.gz
[rubygems/rubygems] Only show "Defaulting to user installation" message when it matters.
https://github.com/rubygems/rubygems/commit/61b0947225
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/command.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index fd2cf61a05..c3a448bc21 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -23,6 +23,15 @@ 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.
attr_reader :command
@@ -323,7 +332,8 @@ class Gem::Command
elsif @when_invoked
@when_invoked.call options
else
- if Gem.paths.auto_user_install && !options[:install_dir] && !options[:user_install]
+ 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