diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-28 00:57:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-28 00:57:53 +0000 |
commit | 69934aeb8d7948c4ca590b7092504c41d8bce6ac (patch) | |
tree | 7ea2cdc73f64c5fd001a4e626613ba435a425c0c /lib/rubygems/spec_fetcher.rb | |
parent | cc00f5bf36a2053e561d968a7e667ff31a9d72d7 (diff) | |
download | ruby-69934aeb8d7948c4ca590b7092504c41d8bce6ac.tar.gz |
rubygems 2.6.7
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update
rubygems to 2.6.7.
Release note of 2.6.7: https://github.com/rubygems/rubygems/commit/60f35bd1d2359fc30301d2d4cd72bc6833e8d12a
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/spec_fetcher.rb')
-rw-r--r-- | lib/rubygems/spec_fetcher.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 755d4be1eb..919276e113 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -184,10 +184,10 @@ class Gem::SpecFetcher # Suggests gems based on the supplied +gem_name+. Returns an array of # alternative gem names. - def suggest_gems_from_name gem_name + def suggest_gems_from_name(gem_name, type = :latest) gem_name = gem_name.downcase.tr('_-', '') max = gem_name.size / 2 - names = available_specs(:latest).first.values.flatten(1) + names = available_specs(type).first.values.flatten(1) matches = names.map { |n| next unless n.match_platform? @@ -201,7 +201,11 @@ class Gem::SpecFetcher [n.name, distance] }.compact - matches = matches.uniq.sort_by { |name, dist| dist } + matches = if matches.empty? && type != :prerelease + suggest_gems_from_name gem_name, :prerelease + else + matches.uniq.sort_by { |name, dist| dist } + end matches.first(5).map { |name, dist| name } end |