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

ruby-changes:69424

From: David <ko1@a...>
Date: Mon, 25 Oct 2021 20:55:07 +0900 (JST)
Subject: [ruby-changes:69424] 4fc29d17b3 (master): [rubygems/rubygems] Cached gem path resolution should consider default gems

https://git.ruby-lang.org/ruby.git/commit/?id=4fc29d17b3

From 4fc29d17b36e12311c1fe1d2f63e463bbf8ad725 Mon Sep 17 00:00:00 2001
From: David Rodriguez <deivid.rodriguez@r...>
Date: Thu, 21 Oct 2021 12:38:53 +0200
Subject: [rubygems/rubygems] Cached gem path resolution should consider
 default gems

https://github.com/rubygems/rubygems/commit/83b2b845b3
---
 lib/bundler/source/rubygems.rb | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index ae77f417530..a4587ac692b 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -174,6 +174,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L174
           Bundler.ui.confirm message
 
           path = cached_gem(spec)
+          raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
           if requires_sudo?
             install_path = Bundler.tmp(spec.full_name)
             bin_path     = install_path.join("bin")
@@ -233,11 +234,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L234
       end
 
       def cache(spec, custom_path = nil)
-        if spec.default_gem?
-          cached_path = cached_built_in_gem(spec)
-        else
-          cached_path = cached_gem(spec)
-        end
+        cached_path = cached_gem(spec)
         raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
         return if File.dirname(cached_path) == Bundler.app_cache.to_s
         Bundler.ui.info "  * #{File.basename(cached_path)}"
@@ -352,11 +349,11 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L349
       end
 
       def cached_gem(spec)
-        cached_gem = cached_path(spec)
-        unless cached_gem
-          raise Bundler::GemNotFound, "Could not find #{spec.file_name} for installation"
+        if spec.default_gem?
+          cached_built_in_gem(spec)
+        else
+          cached_path(spec)
         end
-        cached_gem
       end
 
       def cached_path(spec)
-- 
cgit v1.2.1


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

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