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#fetch_spec
fetch_spec(name_tuple)
lib/rubygems/source.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems/source.rb, line 127
def fetch_spec(name_tuple)
fetcher = Gem::RemoteFetcher.fetcher
spec_file_name = name_tuple.spec_name
source_uri = enforce_trailing_slash(uri) + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
cache_dir = cache_dir source_uri
local_spec = File.join cache_dir, spec_file_name
if File.exist? local_spec
spec = Gem.read_binary local_spec
spec = Marshal.load(spec) rescue nil
return spec if spec
end
source_uri.path << ".rz"
spec = fetcher.fetch_path source_uri
spec = Gem::Util.inflate spec
if update_cache?
require "fileutils"
FileUtils.mkdir_p cache_dir
File.open local_spec, "wb" do |io|
io.write spec
end
end
# TODO: Investigate setting Gem::Specification#loaded_from to a URI
Marshal.load spec
end
Fetches a specification for the given name_tuple.
See also
#enforce_trailing_slash
#load_specs
#download
#typo_squatting?
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0