[rubygems/rubygems] More improves to default gem home selection for installation
https://github.com/rubygems/rubygems/commit/966daf7d42
This commit is contained in:
parent
299eb8d117
commit
0ff34aa13e
@ -664,6 +664,7 @@ class Gem::Installer
|
|||||||
@env_shebang = options[:env_shebang]
|
@env_shebang = options[:env_shebang]
|
||||||
@force = options[:force]
|
@force = options[:force]
|
||||||
@install_dir = options[:install_dir]
|
@install_dir = options[:install_dir]
|
||||||
|
@user_install = options[:user_install]
|
||||||
@ignore_dependencies = options[:ignore_dependencies]
|
@ignore_dependencies = options[:ignore_dependencies]
|
||||||
@format_executable = options[:format_executable]
|
@format_executable = options[:format_executable]
|
||||||
@wrappers = options[:wrappers]
|
@wrappers = options[:wrappers]
|
||||||
@ -675,22 +676,7 @@ class Gem::Installer
|
|||||||
|
|
||||||
@build_args = options[:build_args]
|
@build_args = options[:build_args]
|
||||||
|
|
||||||
@gem_home = @install_dir
|
@gem_home = @install_dir || user_install_dir || Gem.dir
|
||||||
|
|
||||||
unless @gem_home
|
|
||||||
# `--build-root` overrides `--user-install` and auto-user-install
|
|
||||||
if @build_root.nil?
|
|
||||||
# Please note that `options[:user_install]` might have three states:
|
|
||||||
# * `true`: `--user-install`
|
|
||||||
# * `false`: `--no-user-install` and
|
|
||||||
# * `nil`: option was not specified
|
|
||||||
if options[:user_install] || (options[:user_install].nil? && Gem.default_user_install)
|
|
||||||
@gem_home = Gem.user_dir
|
|
||||||
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
|
||||||
@ -986,6 +972,19 @@ TEXT
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def user_install_dir
|
||||||
|
# never install to user home in --build-root mode
|
||||||
|
return unless @build_root.nil?
|
||||||
|
|
||||||
|
# Please note that @user_install might have three states:
|
||||||
|
# * `true`: `--user-install`
|
||||||
|
# * `false`: `--no-user-install` and
|
||||||
|
# * `nil`: option was not specified
|
||||||
|
if @user_install || (@user_install.nil? && Gem.default_user_install)
|
||||||
|
Gem.user_dir
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def build_args
|
def build_args
|
||||||
@build_args ||= begin
|
@build_args ||= begin
|
||||||
require_relative "command"
|
require_relative "command"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user