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

[rubygems/rubygems] Only set local variable in the branch using it

https://github.com/rubygems/rubygems/commit/9fd39bd5a3
This commit is contained in:
David Rodríguez 2021-07-31 13:21:41 +02:00 committed by Hiroshi SHIBATA
parent b351cebab2
commit 2e850e0038
Notes: git 2021-08-31 19:07:21 +09:00

View file

@ -255,12 +255,6 @@ module Bundler
next if name == "bundler"
next unless search_for(requirement).empty?
cache_message = begin
" or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
rescue GemfileNotFound
nil
end
if (base = @base[name]) && !base.empty?
version = base.first.version
message = "You have requested:\n" \
@ -273,6 +267,11 @@ module Bundler
source = source_for(name)
specs = source.specs.search(name)
versions_with_platforms = specs.map {|s| [s.version, s.platform] }
cache_message = begin
" or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
rescue GemfileNotFound
nil
end
message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any?
end