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