Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Commands::RebuildCommand#download_gem
download_gem(gem_name, gem_version, old_file)
lib/rubygems/commands/rebuild_command.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/commands/rebuild_command.rb, line 234
def download_gem(gem_name, gem_version, old_file)
# This code was based loosely off the `gem fetch` command.
version = "= #{gem_version}"
dep = Gem::Dependency.new gem_name, version
specs_and_sources, errors =
Gem::SpecFetcher.fetcher.spec_for_dependency dep
# There should never be more than one item in specs_and_sources,
# since we search for an exact version.
spec, source = specs_and_sources[0]
if spec.nil?
show_lookup_failure gem_name, version, errors, options[:domain]
terminate_interaction 1
end
download_path = source.download spec
FileUtils.move(download_path, old_file)
say "Downloaded #{gem_name} version #{gem_version} as #{old_file}."
end
No documentation available