[前][次][番号順一覧][スレッド一覧]

ruby-changes:61118

From: bronzdoc <ko1@a...>
Date: Fri, 8 May 2020 14:14:41 +0900 (JST)
Subject: [ruby-changes:61118] 7fb694fdb0 (master): [rubygems/rubygems] Show gemspec location when a Gem::MissingSpecError is raised while trying to activate a gem

https://git.ruby-lang.org/ruby.git/commit/?id=7fb694fdb0

From 7fb694fdb0fb56f8e2b3bf800c5f7117f0400f0d Mon Sep 17 00:00:00 2001
From: bronzdoc <lsagastume1990@g...>
Date: Sun, 26 Apr 2020 11:55:37 -0600
Subject: [rubygems/rubygems] Show gemspec location when a
 Gem::MissingSpecError is raised while trying to activate a gem

https://github.com/rubygems/rubygems/commit/4da54a8e8b

diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index ad988a5..bcb5da5 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1395,7 +1395,11 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1395
         raise e
       end
 
-      specs = spec_dep.to_specs
+      begin
+        specs = spec_dep.to_specs
+      rescue Gem::MissingSpecError => e
+        raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{self.spec_file}")
+      end
 
       if specs.size == 1
         specs.first.activate
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 6b18bb9..430c3a6 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1275,6 +1275,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1275
     end
 
     assert_match %r{Could not find 'b' }, e.message
+    assert_match %r{at: #{a.spec_file}}, e.message
   end
 
   def test_self_try_activate_missing_prerelease
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]