From 5ff48066f1093001f38b850a260b8c2bbb553a06 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Fri, 20 Aug 2010 08:53:38 -0700 Subject: [PATCH] '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. --- Library/Homebrew/brew.h.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index 5865427ca9..8c71ca8dc7 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -239,8 +239,9 @@ def cleanup name require 'formula' 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.each do |keg| next if f.prefix == keg @@ -249,8 +250,11 @@ def cleanup name puts end else - # we can't tell which one to keep in this circumstance - opoo "Skipping #{name}: most recent version #{f.version} not installed" + # If the cellar only has one version installed, don't complain + # 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