summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodriguez <deivid.rodriguez@riseup.net>2021-10-21 20:28:02 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-10-25 20:48:51 +0900
commit7073870dfaa31581b2ff6787224712ad6bdd2f15 (patch)
tree89dc108a33835a492ee7df2c7e9a8c583624b8b7 /lib
parentf7f85c1febd23eec04f78bc461b21ea604a865a9 (diff)
[rubygems/rubygems] Improve readability by splitting updating the cache and searching it
https://github.com/rubygems/rubygems/commit/d0df25bb0f
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/source/rubygems.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index d0cfb07e18..11b506b324 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -357,7 +357,10 @@ module Bundler
end
def cached_path(spec)
- possibilities = (@caches << download_cache_path(spec)).compact.map {|p| "#{p}/#{spec.file_name}" }
+ global_cache_path = download_cache_path(spec)
+ @caches << global_cache_path if global_cache_path
+
+ possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
possibilities.find {|p| File.exist?(p) }
end