diff options
Diffstat (limited to 'lib/rubygems/spec_fetcher.rb')
-rw-r--r-- | lib/rubygems/spec_fetcher.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 22fa68db69..12b8fb27d8 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -34,6 +34,10 @@ class Gem::SpecFetcher @fetcher = nil + ## + # Default fetcher instance. Use this instead of ::new to reduce object + # allocation. + def self.fetcher @fetcher ||= new end @@ -43,8 +47,8 @@ class Gem::SpecFetcher end ## - # Creates a new SpecFetcher. Ordinarily you want to use - # Gem::SpecFetcher::fetcher which uses the Gem.sources. + # Creates a new SpecFetcher. Ordinarily you want to use the default fetcher + # from Gem::SpecFetcher::fetcher which uses the Gem.sources. # # If you need to retrieve specifications from a different +source+, you can # send it as an argument. @@ -84,7 +88,11 @@ class Gem::SpecFetcher rejected_specs = {} if dependency.prerelease? - type = :complete + if dependency.specific? + type = :complete + else + type = :abs_latest + end elsif dependency.latest_version? type = :latest else @@ -224,6 +232,12 @@ class Gem::SpecFetcher tuples_for(source, :released) names.sort + when :abs_latest + names = + tuples_for(source, :prerelease, true) + + tuples_for(source, :latest) + + names.sort when :prerelease tuples_for(source, :prerelease) else @@ -239,7 +253,11 @@ class Gem::SpecFetcher [list, errors] end - def tuples_for(source, type, gracefully_ignore=false) + ## + # Retrieves NameTuples from +source+ of the given +type+ (:prerelease, + # etc.). If +gracefully_ignore+ is true, errors are ignored. + + def tuples_for(source, type, gracefully_ignore=false) # :nodoc: cache = @caches[type] tuples = |