End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::Source#load_specs
load_specs(type)
lib/rubygems/source.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems/source.rb, line 173
def load_specs(type)
file = FILES[type]
fetcher = Gem::RemoteFetcher.fetcher
file_name = "#{file}.#{Gem.marshal_version}"
spec_path = enforce_trailing_slash(uri) + "#{file_name}.gz"
cache_dir = cache_dir spec_path
local_file = File.join(cache_dir, file_name)
retried = false
if update_cache?
require "fileutils"
FileUtils.mkdir_p cache_dir
end
spec_dump = fetcher.cache_update_path spec_path, local_file, update_cache?
begin
Gem::NameTuple.from_list Marshal.load(spec_dump)
rescue ArgumentError
if update_cache? && !retried
FileUtils.rm local_file
retried = true
retry
else
raise Gem::Exception.new("Invalid spec cache file in #{local_file}")
end
end
end
Loads type kind of specs fetching from +@uri+ if the on-disk cache is out of date.
type is one of the following:
:released => Return the list of all released specs :latest => Return the list of only the highest version of each gem :prerelease => Return the list of all prerelease only specs
See also
#fetch_spec
#typo_squatting?
#enforce_trailing_slash
#update_cache?
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0