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

ruby-changes:67404

From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:06:46 +0900 (JST)
Subject: [ruby-changes:67404] 8116b7fef7 (master): [rubygems/rubygems] Move rescue block around the code that can raise it

https://git.ruby-lang.org/ruby.git/commit/?id=8116b7fef7

From 8116b7fef7ccef49eda3d1258121bbf343daf12a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 23 Jul 2021 21:32:07 +0200
Subject: [rubygems/rubygems] Move rescue block around the code that can raise
 it

https://github.com/rubygems/rubygems/commit/310937a546
---
 lib/bundler/cli/install.rb |  8 +-------
 lib/bundler/runtime.rb     | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 42b9a3f..4c1915f 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -60,7 +60,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/install.rb#L60
       installer = Installer.install(Bundler.root, definition, options)
 
       Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
-        Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
+        Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
       end
 
       Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
@@ -83,12 +83,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/install.rb#L83
       end
 
       Bundler::CLI::Common.output_fund_metadata_summary
-    rescue GemNotFound
-      if options[:local]
-        Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
-      end
-
-      raise
     rescue Gem::InvalidSpecificationException
       Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
       raise
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 287fa1c..32a94a7 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -104,7 +104,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/runtime.rb#L104
 
     alias_method :gems, :specs
 
-    def cache(custom_path = nil)
+    def cache(custom_path = nil, local = false)
       cache_path = Bundler.app_cache(custom_path)
       SharedHelpers.filesystem_access(cache_path) do |p|
         FileUtils.mkdir_p(p)
@@ -112,7 +112,20 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/runtime.rb#L112
 
       Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}"
 
-      specs_to_cache = Bundler.settings[:cache_all_platforms] ? @definition.resolve.materialized_for_all_platforms : specs
+      specs_to_cache = if Bundler.settings[:cache_all_platforms]
+        @definition.resolve.materialized_for_all_platforms
+      else
+        begin
+          specs
+        rescue GemNotFound
+          if local
+            Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
+          end
+
+          raise
+        end
+      end
+
       specs_to_cache.each do |spec|
         next if spec.name == "bundler"
         next if spec.source.is_a?(Source::Gemspec)
-- 
cgit v1.1


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

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