Fix brew cleanup: don't bail out early

Running `brew cleanup` (with no arguments or multiple arguments) raises
an error and stops as soon as it finds any formula whose most recent
version is not installed.

With this change it will instead print a warning, then continue with the
next formula.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Martin Kuehl 2010-02-16 15:35:37 +01:00 committed by Adam Vandenberg
parent 15e145709b
commit 37189cbe34

View File

@ -250,10 +250,7 @@ def cleanup name
f = Formula.factory name f = Formula.factory name
# we can't tell which one to keep in this circumstance if f.installed? and f.prefix.parent.directory?
raise "The most recent version of #{name} is not installed" unless f.installed?
if f.prefix.parent.directory?
kids = f.prefix.parent.children kids = f.prefix.parent.children
kids.each do |keg| kids.each do |keg|
next if f.prefix == keg next if f.prefix == keg
@ -261,6 +258,9 @@ def cleanup name
FileUtils.rm_rf keg FileUtils.rm_rf keg
puts puts
end end
else
# we can't tell which one to keep in this circumstance
opoo "Skipping #{name}: most recent version #{f.version} not installed"
end end
end end