aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-07-29 00:56:22 +0100
committerMax Howell2009-07-29 01:00:26 +0100
commitfb1db6956f2d8f29c0aa1d25055f1386ad337fa7 (patch)
tree1c08f08ee04c76f6840fa74afa1c399991f92716 /Library
parent6bc261b02e8dcaf9a000c00d3552df9eec382d70 (diff)
downloadhomebrew-fb1db6956f2d8f29c0aa1d25055f1386ad337fa7.tar.bz2
Fix brew rm
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 8330c650f..f724a068e 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -80,9 +80,13 @@ class Keg
end
def rm
+ # don't rmtree shit if we aren't positive about our location!
+ raise "Bad stuff!" unless path.parent.parent == $cellar
+
if path.directory?
FileUtils.chmod_R 0777, path # ensure we have permission to delete
- path.rmtree
+ path.rmtree # $cellar/foo/1.2.0
+ path.parent.rmdir if path.parent.children.length == 0 # $cellar/foo
end
end