aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-08-29 21:07:26 +0100
committerMax Howell2009-08-29 21:07:26 +0100
commit65cb8ea09f1bc7be1eee024a8342e8e129d3b4d4 (patch)
tree1340dc0ce1552bf1506d0fb6e0d76b62d7ff03c9 /Library
parentf7d8003f3b605eb1c25b6f55f88b2bef49c89f8f (diff)
downloadbrew-65cb8ea09f1bc7be1eee024a8342e8e129d3b4d4.tar.bz2
brew unlink command
Closes Homebrew/homebrew#8
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 8ba55f5ee..ad744e840 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -28,6 +28,19 @@ class Keg <Pathname
parent.rmdir_if_possible
end
+ def unlink
+ n=0
+ Pathname.new(self).find do |src|
+ next if src == self
+ dst=HOMEBREW_PREFIX+src.relative_path_from(self)
+ next unless dst.symlink?
+ dst.unlink
+ n+=1
+ Find.prune if src.directory?
+ end
+ n
+ end
+
def link
$n=0
$d=0