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

[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
This commit is contained in:
Olle Jonsson 2020-03-16 07:36:41 +01:00 committed by Hiroshi SHIBATA
parent 39322317f3
commit bb3d80bbbe
Notes: git 2020-05-08 07:39:24 +09:00
2 changed files with 16 additions and 0 deletions

View file

@ -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__)

View file

@ -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']