1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Remove MacOS specific extra GEM_PATH

They should properly configure `GEM_PATH` instead.

https://github.com/rubygems/rubygems/commit/3bd9ae33ca
This commit is contained in:
David Rodríguez 2021-08-08 10:40:11 +02:00 committed by Hiroshi SHIBATA
parent afabef5a5a
commit d01c3111c2
Notes: git 2021-08-31 19:07:07 +09:00
3 changed files with 3 additions and 55 deletions

View file

@ -462,20 +462,8 @@ By default, this RubyGems will install gem as:
lib_dir = RbConfig::CONFIG[site_or_vendor] lib_dir = RbConfig::CONFIG[site_or_vendor]
bin_dir = RbConfig::CONFIG['bindir'] bin_dir = RbConfig::CONFIG['bindir']
else else
# Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets lib_dir = File.join prefix, 'lib'
# confused about installation location, so switch back to bin_dir = File.join prefix, 'bin'
# sitelibdir/vendorlibdir.
if defined?(APPLE_GEM_HOME) and
# just in case Apple and RubyGems don't get this patched up proper.
(prefix == RbConfig::CONFIG['libdir'] or
# this one is important
prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby'))
lib_dir = RbConfig::CONFIG[site_or_vendor]
bin_dir = RbConfig::CONFIG['bindir']
else
lib_dir = File.join prefix, 'lib'
bin_dir = File.join prefix, 'bin'
end
end end
unless install_destdir.empty? unless install_destdir.empty?

View file

@ -72,12 +72,7 @@ class Gem::PathSupport
# Return the default Gem path # Return the default Gem path
def default_path def default_path
gem_path = Gem.default_path + [@home] Gem.default_path + [@home]
if defined?(APPLE_GEM_HOME)
gem_path << APPLE_GEM_HOME
end
gem_path
end end
def expand(path) def expand(path)

View file

@ -943,44 +943,9 @@ class TestGem < Gem::TestCase
def test_self_path_default def test_self_path_default
util_path util_path
if defined?(APPLE_GEM_HOME)
orig_APPLE_GEM_HOME = APPLE_GEM_HOME
Object.send :remove_const, :APPLE_GEM_HOME
end
Gem.instance_variable_set :@paths, nil Gem.instance_variable_set :@paths, nil
assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
ensure
Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME if orig_APPLE_GEM_HOME
end
unless win_platform?
def test_self_path_APPLE_GEM_HOME
util_path
Gem.clear_paths
apple_gem_home = File.join @tempdir, 'apple_gem_home'
old, $-w = $-w, nil
Object.const_set :APPLE_GEM_HOME, apple_gem_home
$-w = old
assert_includes Gem.path, apple_gem_home
ensure
Object.send :remove_const, :APPLE_GEM_HOME
end
def test_self_path_APPLE_GEM_HOME_GEM_PATH
Gem.clear_paths
ENV['GEM_PATH'] = @gemhome
apple_gem_home = File.join @tempdir, 'apple_gem_home'
Gem.const_set :APPLE_GEM_HOME, apple_gem_home
refute Gem.path.include?(apple_gem_home)
ensure
Gem.send :remove_const, :APPLE_GEM_HOME
end
end end
def test_self_path_ENV_PATH def test_self_path_ENV_PATH