aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisty De Meo2012-10-04 14:15:16 -0500
committerMisty De Meo2012-10-04 21:37:37 -0500
commit0f2fe4a61b3270db98defbaab794f63aa0bf24f2 (patch)
tree567b36d5efc8c82ba6e3a6844884847a9e8309f5
parenta1f6f590d2f6c52d98d0a469300320cabf85ac3a (diff)
downloadbrew-0f2fe4a61b3270db98defbaab794f63aa0bf24f2.tar.bz2
Keg#unlink: use ObserverPathnameExtension
#link was using the extension but #unlink wasn't, so the counting criteria were potentially different and `brew unlink` was ignoring --verbose.
-rw-r--r--Library/Homebrew/keg.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 76e02b629..a5af2a19b 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -27,13 +27,16 @@ class Keg < Pathname
end
def unlink
- n=0
+ # these are used by the ObserverPathnameExtension to count the number
+ # of files and directories linked
+ $n=$d=0
%w[bin etc lib include sbin share var].map{ |d| self/d }.each do |src|
next unless src.exist?
src.find do |src|
next if src == self
dst=HOMEBREW_PREFIX+src.relative_path_from(self)
+ dst.extend ObserverPathnameExtension
# check whether the file to be unlinked is from the current keg first
if !dst.symlink? || !dst.exist? || src != dst.resolved_path
@@ -43,12 +46,11 @@ class Keg < Pathname
dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO']
dst.unlink
dst.parent.rmdir_if_possible
- n+=1
Find.prune if src.directory?
end
end
linked_keg_record.unlink if linked_keg_record.symlink?
- n
+ $n+$d
end
def fname
@@ -84,8 +86,6 @@ class Keg < Pathname
def link mode=nil
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?
- # these are used by the ObserverPathnameExtension to count the number
- # of files and directories linked
$n=0
$d=0