Prefer HEAD version if its installed
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
parent
f4ce357d44
commit
a305360099
@ -199,7 +199,7 @@ def info f
|
|||||||
kids=f.prefix.parent.children
|
kids=f.prefix.parent.children
|
||||||
kids.each do |keg|
|
kids.each do |keg|
|
||||||
print "#{keg} (#{keg.abv})"
|
print "#{keg} (#{keg.abv})"
|
||||||
print " *" if f.prefix == keg and kids.length > 1
|
print " *" if f.installed_prefix == keg and kids.length > 1
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -258,7 +258,7 @@ def cleanup name
|
|||||||
if f.installed? and formula_cellar.directory?
|
if f.installed? and formula_cellar.directory?
|
||||||
kids = f.prefix.parent.children
|
kids = f.prefix.parent.children
|
||||||
kids.each do |keg|
|
kids.each do |keg|
|
||||||
next if f.prefix == keg
|
next if f.installed_prefix == keg
|
||||||
print "Uninstalling #{keg}..."
|
print "Uninstalling #{keg}..."
|
||||||
FileUtils.rm_rf keg
|
FileUtils.rm_rf keg
|
||||||
puts
|
puts
|
||||||
|
|||||||
@ -98,11 +98,20 @@ class Formula
|
|||||||
|
|
||||||
# if the dir is there, but it's empty we consider it not installed
|
# if the dir is there, but it's empty we consider it not installed
|
||||||
def installed?
|
def installed?
|
||||||
return prefix.children.length > 0
|
return installed_prefix.children.length > 0
|
||||||
rescue
|
rescue
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def installed_prefix
|
||||||
|
head_prefix = HOMEBREW_CELLAR+@name+'HEAD'
|
||||||
|
if @version == 'HEAD' || head_prefix.directory?
|
||||||
|
head_prefix
|
||||||
|
else
|
||||||
|
prefix
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
self.class.path name
|
self.class.path name
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user