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.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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user