'brew cleanup' no longer complains about single versions

Previously "brew cleanup" would complain if the most recent
version of a brew wasn't installed.

We now suppress this message if only one (outdated) formula is
present.
This commit is contained in:
Adam Vandenberg 2010-08-20 08:53:38 -07:00
parent 115ffb226d
commit 5ff48066f1

View File

@ -239,8 +239,9 @@ def cleanup name
require 'formula' require 'formula'
f = Formula.factory name f = Formula.factory name
formula_cellar = f.prefix.parent
if f.installed? and f.prefix.parent.directory? if f.installed? and formula_cellar.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
@ -249,8 +250,11 @@ def cleanup name
puts puts
end end
else else
# we can't tell which one to keep in this circumstance # If the cellar only has one version installed, don't complain
opoo "Skipping #{name}: most recent version #{f.version} not installed" # that we can't tell which one to keep.
if formula_cellar.children.length > 1
opoo "Skipping #{name}: most recent version #{f.version} not installed"
end
end end
end end