linkapps: replace #max_by with #max

Enumerable#max_by didn't exist in 1.8.6, so linkapps failed on Leopard.
This commit is contained in:
Misty De Meo 2013-06-06 09:26:20 -05:00
parent 515578723e
commit 92d65aace7

View File

@ -13,7 +13,7 @@ HOMEBREW_CELLAR.subdirs.each do |rack|
kegs = rack.subdirs.map { |d| Keg.new(d) }
next if kegs.empty?
keg = kegs.detect(&:linked?) || kegs.max_by(&:version)
keg = kegs.detect(&:linked?) || kegs.max {|a,b| a.version <=> b.version}
Dir["#{keg}/*.app", "#{keg}/bin/*.app", "#{keg}/libexec/*.app"].each do |app|
puts "Linking #{app}"