From 2e850e0038e8ba9a5dd3266e9f0f6b2821f19084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sat, 31 Jul 2021 13:21:41 +0200 Subject: [PATCH] [rubygems/rubygems] Only set local variable in the branch using it https://github.com/rubygems/rubygems/commit/9fd39bd5a3 --- lib/bundler/resolver.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 2cfe25fe8c..0e28e8559b 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -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