summaryrefslogtreecommitdiff
path: root/lib/bundler
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-01-17 21:47:32 +0100
committergit <svn-admin@ruby-lang.org>2022-08-06 15:41:45 +0900
commitaf40af45b28a9576d5ae6a46d9678c0e3d6be005 (patch)
tree6fb0c0c4f86628c02881c3423107601b052022d4 /lib/bundler
parent27173e3735ff509dc8d9cc9b410baff84adf57dc (diff)
downloadruby-af40af45b28a9576d5ae6a46d9678c0e3d6be005.tar.gz
[rubygems/rubygems] Extract `SourceList#get_with_fallback`
https://github.com/rubygems/rubygems/commit/9dbc4757a8
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/definition.rb2
-rw-r--r--lib/bundler/source_list.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index ccb3ab1cec..30e1820eec 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -743,7 +743,7 @@ module Bundler
# Replace the locked dependency's source with the equivalent source from the Gemfile
dep = @dependencies.find {|d| s.satisfies?(d) }
- s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source
+ s.source = (dep && dep.source) || sources.get_with_fallback(s.source)
next if @unlock[:sources].include?(s.source.name)
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index a4773397c7..6ea2910d18 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -101,6 +101,10 @@ module Bundler
source_list_for(source).find {|s| equivalent_source?(source, s) }
end
+ def get_with_fallback(source)
+ get(source) || default_source
+ end
+
def lock_sources
lock_other_sources + lock_rubygems_sources
end