summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVít Ondruch <[email protected]>2023-12-08 14:03:07 +0100
committerHiroshi SHIBATA <[email protected]>2023-12-12 10:04:56 +0900
commitb37288c047681e02615b5b484fb265b394ddc612 ()
tree2bec98aa06a7e714669743851663df36290278a3 /lib
parentc032dfb5cbd844a8474a1397e65b4e04203d0ddd (diff)
[rubygems/rubygems] Make the "auto-user-install" logic easier to follow
https://.com/rubygems/rubygems/commit/4b4d9c0106
-rw-r--r--lib/rubygems/installer.rb22
1 files changed, 13 insertions, 9 deletions
@@ -675,16 +675,20 @@ class Gem::Installer
@build_args = options[:build_args]
- @gem_home = @install_dir || Gem.dir
-
- # `--build-root` overrides `--user-install` and auto-user-install
- if @build_root.nil? && @install_dir.nil?
- if options[:user_install]
- @gem_home = Gem.user_dir
- elsif !ENV.key?("GEM_HOME") && (File.exist?(Gem.dir) && !File.writable?(Gem.dir))
- say "Defaulting to user installation because default installation directory (#{Gem.dir}) is not writable."
- @gem_home = Gem.user_dir
end
end
# If the user has asked for the gem to be installed in a directory that is