[rubygems/rubygems] Make the "auto-user-install" logic easier to follow
https://github.com/rubygems/rubygems/commit/4b4d9c0106
This commit is contained in:
parent
c032dfb5cb
commit
b37288c047
@ -675,10 +675,11 @@ class Gem::Installer
|
|||||||
|
|
||||||
@build_args = options[:build_args]
|
@build_args = options[:build_args]
|
||||||
|
|
||||||
@gem_home = @install_dir || Gem.dir
|
@gem_home = @install_dir
|
||||||
|
|
||||||
|
unless @gem_home
|
||||||
# `--build-root` overrides `--user-install` and auto-user-install
|
# `--build-root` overrides `--user-install` and auto-user-install
|
||||||
if @build_root.nil? && @install_dir.nil?
|
if @build_root.nil?
|
||||||
if options[:user_install]
|
if options[:user_install]
|
||||||
@gem_home = Gem.user_dir
|
@gem_home = Gem.user_dir
|
||||||
elsif !ENV.key?("GEM_HOME") && (File.exist?(Gem.dir) && !File.writable?(Gem.dir))
|
elsif !ENV.key?("GEM_HOME") && (File.exist?(Gem.dir) && !File.writable?(Gem.dir))
|
||||||
@ -687,6 +688,9 @@ class Gem::Installer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@gem_home ||= Gem.dir
|
||||||
|
end
|
||||||
|
|
||||||
# If the user has asked for the gem to be installed in a directory that is
|
# If the user has asked for the gem to be installed in a directory that is
|
||||||
# the system gem directory, then use the system bin directory, else create
|
# the system gem directory, then use the system bin directory, else create
|
||||||
# (or use) a new bin dir under the gem_home.
|
# (or use) a new bin dir under the gem_home.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user