aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJoshua Peek2009-12-22 11:31:54 -0600
committerMax Howell2010-01-18 08:27:50 +0000
commitffd39835ec005a783fffdd5ef0bca2754f3117ad (patch)
treeda6944b60bc8f693d429765be21e12507e12d858 /Library
parentae3f858f07b1e684478cd9f07abeeae5c0a11e91 (diff)
downloadhomebrew-ffd39835ec005a783fffdd5ef0bca2754f3117ad.tar.bz2
Add cleanup command
* `brew cleanup foo` removes any unlinked foo kegs * `brew cleanup` removes all unlinked kegs
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brew.h.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index 51221a23f..55a416c09 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -245,6 +245,22 @@ rescue
[]
end
+def cleanup name
+ require 'formula'
+
+ f = Formula.factory name
+
+ if f.prefix.parent.directory?
+ kids = f.prefix.parent.children
+ kids.each do |keg|
+ next if f.prefix == keg
+ print "Uninstalling #{keg}..."
+ FileUtils.rm_rf keg
+ puts
+ end
+ end
+end
+
def clean f
Cleaner.new f