From 56660de3c6df7a4ff8667ef4047d30d0de169935 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sat, 1 Jun 2019 12:45:11 +0300 Subject: Merge rubygems master from upstream. I picked the commit from 3c469e0da538428a0ddd94f99aa73c32da22e8ba --- lib/rubygems.rb | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'lib/rubygems.rb') diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 193e8d3539..c013e4b8ed 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -670,6 +670,21 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} index end + ## + # Add a list of paths to the $LOAD_PATH at the proper place. + + def self.add_to_load_path(*paths) + insert_index = load_path_insert_index + + if insert_index + # gem directories must come after -I and ENV['RUBYLIB'] + $LOAD_PATH.insert(insert_index, *paths) + else + # we are probably testing in core, -I and RUBYLIB don't apply + $LOAD_PATH.unshift(*paths) + end + end + @yaml_loaded = false ## @@ -1083,6 +1098,13 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} @@win_platform end + ## + # Is this a java platform? + + def self.java_platform? + RUBY_PLATFORM == "java" + end + ## # Load +plugins+ as Ruby files @@ -1243,7 +1265,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} # def register_default_spec(spec) - new_format = Gem.default_gems_use_full_paths? || spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } } + new_format = spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } } if new_format prefix_group = spec.require_paths.map {|f| f + "/"}.join("|") -- cgit v1.2.3