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

[rubygems/rubygems] Move rescue block around the code that can raise it

https://github.com/rubygems/rubygems/commit/310937a546
This commit is contained in:
David Rodríguez 2021-07-23 21:32:07 +02:00 committed by Hiroshi SHIBATA
parent c6e5267a77
commit 8116b7fef7
Notes: git 2021-08-31 19:07:28 +09:00
2 changed files with 16 additions and 9 deletions

View file

@ -60,7 +60,7 @@ module Bundler
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
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

View file

@ -104,7 +104,7 @@ module Bundler
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
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)