Skip to content

Commit

Permalink
Remove MacOS specific extra GEM_PATH
Browse files Browse the repository at this point in the history
They should properly configure `GEM_PATH` instead.
  • Loading branch information
deivid-rodriguez committed Aug 9, 2021
1 parent ecad900 commit 3bd9ae3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 55 deletions.
16 changes: 2 additions & 14 deletions lib/rubygems/commands/setup_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,20 +462,8 @@ def generate_default_dirs(install_destdir)
lib_dir = RbConfig::CONFIG[site_or_vendor]
bin_dir = RbConfig::CONFIG['bindir']
else
# Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets
# confused about installation location, so switch back to
# 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
lib_dir = File.join prefix, 'lib'
bin_dir = File.join prefix, 'bin'
end

unless install_destdir.empty?
Expand Down
7 changes: 1 addition & 6 deletions lib/rubygems/path_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@ def split_gem_path(gpaths, home)

# Return the default Gem path
def default_path
gem_path = Gem.default_path + [@home]

if defined?(APPLE_GEM_HOME)
gem_path << APPLE_GEM_HOME
end
gem_path
Gem.default_path + [@home]
end

def expand(path)
Expand Down
35 changes: 0 additions & 35 deletions test/rubygems/test_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -943,44 +943,9 @@ def test_self_path
def test_self_path_default
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

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

def test_self_path_ENV_PATH
Expand Down

0 comments on commit 3bd9ae3

Please sign in to comment.