From 7d32830b8ce14cc130d052a4aa67495a34ed55dc Mon Sep 17 00:00:00 2001 From: Ellen Marie Dash Date: Thu, 30 Nov 2023 20:20:38 -0500 Subject: [rubygems/rubygems] Make --build-root disable auto-user-install. https://github.com/rubygems/rubygems/commit/6a06b0763f --- lib/rubygems/installer.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 18170230df..0477b47035 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -675,14 +675,16 @@ class Gem::Installer @build_args = options[:build_args] - @gem_home = @install_dir - @gem_home ||= if options[:user_install] - 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.user_dir - else - Gem.dir + @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 -- cgit v1.2.3