[rubygems/rubygems] Simplify handling default gem caching

By the time `cached_gem` is called, default gem cache has already been
handled. So no need to try redownload it again, it's enough to check the
cache location directly.

https://github.com/rubygems/rubygems/commit/70e10236b6
This commit is contained in:
David Rodríguez 2024-09-12 16:41:34 +02:00 committed by git
parent d57bc870ac
commit 2bfeedc082

View File

@ -223,11 +223,12 @@ module Bundler
end
def cached_built_in_gem(spec)
cached_path = cached_path(spec)
cached_path = cached_gem(spec)
if cached_path.nil?
remote_spec = remote_specs.search(spec).first
if remote_spec
cached_path = fetch_gem(remote_spec)
spec.remote = remote_spec.remote
else
Bundler.ui.warn "#{spec.full_name} is built in to Ruby, and can't be cached because your Gemfile doesn't have any sources that contain it."
end
@ -324,14 +325,6 @@ module Bundler
end
def cached_gem(spec)
if spec.default_gem?
cached_built_in_gem(spec)
else
cached_path(spec)
end
end
def cached_path(spec)
global_cache_path = download_cache_path(spec)
caches << global_cache_path if global_cache_path