[rubygems/rubygems] Simplify SpecSet#sorted

a3f365bbaa
This commit is contained in:
David Rodríguez 2025-01-30 09:27:20 +01:00 committed by Hiroshi SHIBATA
parent e59c90118e
commit c94cec27f7
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -295,15 +295,12 @@ module Bundler
end end
def sorted def sorted
rake = @specs.find {|s| s.name == "rake" } @sorted ||= ([@specs.find {|s| s.name == "rake" }] + tsort).compact.uniq
begin rescue TSort::Cyclic => error
@sorted ||= ([rake] + tsort).compact.uniq cgems = extract_circular_gems(error)
rescue TSort::Cyclic => error raise CyclicDependencyError, "Your bundle requires gems that depend" \
cgems = extract_circular_gems(error) " on each other, creating an infinite loop. Please remove either" \
raise CyclicDependencyError, "Your bundle requires gems that depend" \ " gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
" on each other, creating an infinite loop. Please remove either" \
" gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
end
end end
def extract_circular_gems(error) def extract_circular_gems(error)