add Formula.racks
Also exclude symlink when enumerating installed racks.
This commit is contained in:
		
							parent
							
								
									c7a484824c
								
							
						
					
					
						commit
						203cecb463
					
				@ -31,8 +31,7 @@ module Homebrew
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def cleanup_cellar
 | 
			
		||||
    return unless HOMEBREW_CELLAR.directory?
 | 
			
		||||
    HOMEBREW_CELLAR.subdirs.each do |rack|
 | 
			
		||||
    Formula.racks.each do |rack|
 | 
			
		||||
      begin
 | 
			
		||||
        cleanup_formula Formulary.from_rack(rack)
 | 
			
		||||
      rescue FormulaUnavailableError, TapFormulaAmbiguityError
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ module Homebrew
 | 
			
		||||
  def print_info
 | 
			
		||||
    if ARGV.named.empty?
 | 
			
		||||
      if HOMEBREW_CELLAR.exist?
 | 
			
		||||
        count = HOMEBREW_CELLAR.subdirs.length
 | 
			
		||||
        count = Formula.racks.length
 | 
			
		||||
        puts "#{count} keg#{plural(count)}, #{HOMEBREW_CELLAR.abv}"
 | 
			
		||||
      end
 | 
			
		||||
    else
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,6 @@
 | 
			
		||||
# Links any Applications (.app) found in installed prefixes to /Applications
 | 
			
		||||
require "keg"
 | 
			
		||||
require "formula"
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  def linkapps
 | 
			
		||||
@ -12,8 +13,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if ARGV.named.empty?
 | 
			
		||||
      racks = HOMEBREW_CELLAR.subdirs
 | 
			
		||||
      kegs = racks.map do |rack|
 | 
			
		||||
      kegs = Formula.racks.map do |rack|
 | 
			
		||||
        keg = rack.subdirs.map { |d| Keg.new(d) }
 | 
			
		||||
        next if keg.empty?
 | 
			
		||||
        keg.detect(&:linked?) || keg.max { |a, b| a.version <=> b.version }
 | 
			
		||||
 | 
			
		||||
@ -78,7 +78,7 @@ module Homebrew
 | 
			
		||||
 | 
			
		||||
  def filtered_list
 | 
			
		||||
    names = if ARGV.named.empty?
 | 
			
		||||
      HOMEBREW_CELLAR.subdirs
 | 
			
		||||
      Formula.racks
 | 
			
		||||
    else
 | 
			
		||||
      ARGV.named.map { |n| HOMEBREW_CELLAR+n }.select(&:exist?)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -809,18 +809,23 @@ class Formula
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # An array of all racks currently installed.
 | 
			
		||||
  def self.racks
 | 
			
		||||
    @racks ||= if HOMEBREW_CELLAR.directory?
 | 
			
		||||
      HOMEBREW_CELLAR.subdirs.reject(&:symlink?)
 | 
			
		||||
    else
 | 
			
		||||
      []
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # An array of all installed {Formula}
 | 
			
		||||
  def self.installed
 | 
			
		||||
    @installed ||= if HOMEBREW_CELLAR.directory?
 | 
			
		||||
      HOMEBREW_CELLAR.subdirs.map do |rack|
 | 
			
		||||
    @installed ||= racks.map do |rack|
 | 
			
		||||
      begin
 | 
			
		||||
        Formulary.from_rack(rack)
 | 
			
		||||
      rescue FormulaUnavailableError, TapFormulaAmbiguityError
 | 
			
		||||
      end
 | 
			
		||||
    end.compact
 | 
			
		||||
    else
 | 
			
		||||
      []
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.aliases
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user