[rubygems/rubygems] Simplify nested require exceptions
https://github.com/rubygems/rubygems/commit/7fbef2f0e3
This commit is contained in:
parent
43daf4d288
commit
1039c32de6
Notes:
git
2020-05-08 14:14:28 +09:00
@ -156,8 +156,7 @@ module Kernel
|
|||||||
RUBYGEMS_ACTIVATION_MONITOR.enter
|
RUBYGEMS_ACTIVATION_MONITOR.enter
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if load_error.message.start_with?("Could not find") or
|
if load_error.message.end_with?(path) and Gem.try_activate(path)
|
||||||
(load_error.message.end_with?(path) and Gem.try_activate(path))
|
|
||||||
require_again = true
|
require_again = true
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
@ -91,6 +91,25 @@ class TestKernel < Gem::TestCase
|
|||||||
refute $:.any? { |p| %r{a-1/bin} =~ p }
|
refute $:.any? { |p| %r{a-1/bin} =~ p }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_gem_failing_inside_require_doesnt_cause_double_exceptions
|
||||||
|
File.write("activate.rb", "gem('a', '= 999')\n")
|
||||||
|
|
||||||
|
require "open3"
|
||||||
|
|
||||||
|
output, _ = Open3.capture2e(
|
||||||
|
{ "GEM_HOME" => Gem.paths.home },
|
||||||
|
Gem.ruby,
|
||||||
|
"-I",
|
||||||
|
File.expand_path("../../lib", __dir__),
|
||||||
|
"-r",
|
||||||
|
"./activate.rb"
|
||||||
|
)
|
||||||
|
|
||||||
|
load_errors = output.split("\n").select { |line| line.include?("Could not find")}
|
||||||
|
|
||||||
|
assert_equal 1, load_errors.size
|
||||||
|
end
|
||||||
|
|
||||||
def test_gem_bundler
|
def test_gem_bundler
|
||||||
quick_gem 'bundler', '1'
|
quick_gem 'bundler', '1'
|
||||||
quick_gem 'bundler', '2.a'
|
quick_gem 'bundler', '2.a'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user