diff options
author | Olle Jonsson <olle.jonsson@gmail.com> | 2020-03-16 07:36:41 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-08 07:38:50 +0900 |
commit | bb3d80bbbe0603e9f9689a96c7ce86682053b4dd (patch) | |
tree | 1749e52131452afe57f0cb0eed0c0c2cf8c86520 | |
parent | 39322317f3442e71a997503059fb644f31e0ea3e (diff) |
[rubygems/rubygems] Autoload name_tuple.rb before use
- Resolver asked Molinillo to resolve-then-activate, which led to using Gem::NameTuple before any require had been passed
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
https://github.com/rubygems/rubygems/commit/e11782b0c8
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3087
-rw-r--r-- | lib/rubygems.rb | 1 | ||||
-rw-r--r-- | test/rubygems/test_gem.rb | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index bf9e92c546..9c074a375f 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -1307,6 +1307,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__) autoload :Installer, File.expand_path('rubygems/installer', __dir__) autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__) + autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__) autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__) autoload :Platform, File.expand_path('rubygems/platform', __dir__) autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__) diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 5f70a2ac6b..c122287e68 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -302,6 +302,21 @@ class TestGem < Gem::TestCase assert_equal %w[a-1 b-2 c-1], loaded_spec_names end + def test_activate_bin_path_in_debug_mode + a1 = util_spec 'a', '1' do |s| + s.executables = ['exec'] + end + + install_specs a1 + + output, status = Open3.capture2e( + { "GEM_HOME" => Gem.paths.home, "DEBUG_RESOLVER" => "1" }, + Gem.ruby, "-I", File.expand_path("../../lib", __dir__), "-e", "\"Gem.activate_bin_path('a', 'exec', '>= 0')\"" + ) + + assert status.success?, output + end + def test_activate_bin_path_gives_proper_error_for_bundler bundler = util_spec 'bundler', '2' do |s| s.executables = ['bundle'] |