buildRubyGem: use Gem.use_paths to load gems

After ruby initializes, rubygems no longer reads the GEM_PATH. Before,
we have the following scenario:

    Gem.path # => ["a"]
    ENV['GEM_PATH'] = ["b"]
    Gem.path # => ["a"] # Still returns the same

Gem.use_paths is the documented way to create isolated environments as
documented in [1].

[1] http://www.rubydoc.info/github/rubygems/rubygems/Gem.use_paths
This commit is contained in:
Allan Espinosa 2016-03-16 17:28:02 -05:00
parent c2013ea4ec
commit 52b61dce47

View File

@ -64,8 +64,7 @@ spec.executables.each do |exe|
# this file is here to facilitate running it. # this file is here to facilitate running it.
# #
gem_path = ENV["GEM_PATH"] Gem.use_paths "#{gem_home}", #{gem_path.to_s}
ENV["GEM_PATH"] = "\#{gem_path}\#{":" unless gem_path.nil? || gem_path.empty?}#{(gem_path+[gem_home]).join(":")}"
require 'rubygems' require 'rubygems'