aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJoshua Peek2010-09-24 11:55:21 -0500
committerAdam Vandenberg2010-10-26 09:39:17 -0700
commita98a22503321ea36088663089e8ba8cd124ef019 (patch)
tree66c1360aa0ae29cbc163dcc27756b892de9eb54d /Library
parentd89bcba4ef99dc1e8ecce8733350d06b664431bf (diff)
downloadhomebrew-a98a22503321ea36088663089e8ba8cd124ef019.tar.bz2
Prefer HEAD version if its installed
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brew.h.rb4
-rw-r--r--Library/Homebrew/formula.rb11
2 files changed, 12 insertions, 3 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index 73da9790f..ff45a4ad8 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -199,7 +199,7 @@ def info f
kids=f.prefix.parent.children
kids.each do |keg|
print "#{keg} (#{keg.abv})"
- print " *" if f.prefix == keg and kids.length > 1
+ print " *" if f.installed_prefix == keg and kids.length > 1
puts
end
else
@@ -258,7 +258,7 @@ def cleanup name
if f.installed? and formula_cellar.directory?
kids = f.prefix.parent.children
kids.each do |keg|
- next if f.prefix == keg
+ next if f.installed_prefix == keg
print "Uninstalling #{keg}..."
FileUtils.rm_rf keg
puts
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index d6a536f5f..d9f110982 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -98,11 +98,20 @@ class Formula
# if the dir is there, but it's empty we consider it not installed
def installed?
- return prefix.children.length > 0
+ return installed_prefix.children.length > 0
rescue
return false
end
+ def installed_prefix
+ head_prefix = HOMEBREW_CELLAR+@name+'HEAD'
+ if @version == 'HEAD' || head_prefix.directory?
+ head_prefix
+ else
+ prefix
+ end
+ end
+
def path
self.class.path name
end