aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/source
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-06-30 11:55:15 +0200
committergit <svn-admin@ruby-lang.org>2022-07-02 19:41:02 +0900
commit7b78aba53aa0b34800bfd96e9e278258d2a890c8 (patch)
tree31ba912b9f385a48e927d745f7fdae7d2ea98307 /lib/bundler/source
parent9101269e948d838c916ea8342b8e6edce2e0957c (diff)
downloadruby-7b78aba53aa0b34800bfd96e9e278258d2a890c8.tar.gz
[rubygems/rubygems] Account for default gems not having remote when caching
https://github.com/rubygems/rubygems/commit/b93d4de2ff
Diffstat (limited to 'lib/bundler/source')
-rw-r--r--lib/bundler/source/rubygems.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 7200f54a9c..a50934b315 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -153,13 +153,11 @@ module Bundler
# Check for this spec from other sources
uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
-
- path = fetch_gem(spec, options[:previous_spec])
- else
- path = cached_gem(spec)
- raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
end
+ path = fetch_gem_if_possible(spec, options[:previous_spec])
+ raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
+
return if Bundler.settings[:no_install]
if requires_sudo?
@@ -242,7 +240,7 @@ module Bundler
end
def cache(spec, custom_path = nil)
- cached_path = Bundler.settings[:cache_all_platforms] ? fetch_gem(spec) : cached_gem(spec)
+ cached_path = Bundler.settings[:cache_all_platforms] ? fetch_gem_if_possible(spec) : cached_gem(spec)
raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
return if File.dirname(cached_path) == Bundler.app_cache.to_s
Bundler.ui.info " * #{File.basename(cached_path)}"
@@ -462,6 +460,14 @@ module Bundler
end
end
+ def fetch_gem_if_possible(spec, previous_spec = nil)
+ if spec.remote
+ fetch_gem(spec, previous_spec)
+ else
+ cached_gem(spec)
+ end
+ end
+
def fetch_gem(spec, previous_spec = nil)
spec.fetch_platform