From af40af45b28a9576d5ae6a46d9678c0e3d6be005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 17 Jan 2022 21:47:32 +0100 Subject: [PATCH] [rubygems/rubygems] Extract `SourceList#get_with_fallback` https://github.com/rubygems/rubygems/commit/9dbc4757a8 --- lib/bundler/definition.rb | 2 +- lib/bundler/source_list.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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