ruby-changes:70272
From: David <ko1@a...>
Date: Fri, 17 Dec 2021 16:35:33 +0900 (JST)
Subject: [ruby-changes:70272] c710cdb905 (master): [rubygems/rubygems] Improve error message if only platform doesn't match
https://git.ruby-lang.org/ruby.git/commit/?id=c710cdb905 From c710cdb905a58b4ef0c7b5a9a8e867b382ccfd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Tue, 14 Dec 2021 15:56:03 +0100 Subject: [rubygems/rubygems] Improve error message if only platform doesn't match https://github.com/rubygems/rubygems/commit/077e3c2e4d --- lib/bundler/resolver.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 8830621e0ef..dfea95e30a5 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -264,13 +264,23 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/resolver.rb#L264 else source = source_for(name) specs = source.specs.search(name) + matching_part = name + requirement_label = SharedHelpers.pretty_dependency(requirement) 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 gems matching '#{name}': #{specs.map(&:full_name).join(", ")}" if specs.any? + specs_matching_requirement = specs.select {| spec| requirement.matches_spec?(spec) } + + if specs_matching_requirement.any? + specs = specs_matching_requirement + matching_part = requirement_label + requirement_label = "#{requirement_label} #{requirement.__platform}" + end + + message = String.new("Could not find gem '#{requirement_label}' in #{source}#{cache_message}.\n") + message << "The source contains the following gems matching '#{matching_part}': #{specs.map(&:full_name).join(", ")}" if specs.any? end raise GemNotFound, message end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/