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
commit211404c83b360e2853ce2648297a5bf8c42a0484 (patch)
treec01e4186e9e76b096eeb77427d7799598462ac63 /Library
parente2d937d751db58ae876fa6c49e8868c5889593c4 (diff)
downloadhomebrew-211404c83b360e2853ce2648297a5bf8c42a0484.tar.bz2
brew unlink command
Closes #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