[rubygems/rubygems] Simplify SpecSet#sorted

https://github.com/rubygems/rubygems/commit/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
def sorted
rake = @specs.find {|s| s.name == "rake" }
begin
@sorted ||= ([rake] + tsort).compact.uniq
rescue TSort::Cyclic => error
cgems = extract_circular_gems(error)
raise CyclicDependencyError, "Your bundle requires gems that depend" \
" on each other, creating an infinite loop. Please remove either" \
" gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
end
@sorted ||= ([@specs.find {|s| s.name == "rake" }] + tsort).compact.uniq
rescue TSort::Cyclic => error
cgems = extract_circular_gems(error)
raise CyclicDependencyError, "Your bundle requires gems that depend" \
" on each other, creating an infinite loop. Please remove either" \
" gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
end
def extract_circular_gems(error)