mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-15 19:56:59 +08:00

The heuristic for determining whether something is installed changes from "f.installed?" to "f.rack.exist? and f.rack.subdirs.length > 0" in order to properly consider outdated formulae. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
43 lines
908 B
Ruby
43 lines
908 B
Ruby
require 'formula'
|
|
|
|
module Homebrew extend self
|
|
def installed_brews
|
|
formulae = []
|
|
HOMEBREW_CELLAR.subdirs.each do |rack|
|
|
f = Formula.factory rack.basename.to_s rescue nil
|
|
formulae << f if f and f.rack.exist? and f.rack.subdirs.length > 0
|
|
end
|
|
formulae
|
|
end
|
|
|
|
def missing_deps ff
|
|
missing = {}
|
|
ff.each do |f|
|
|
missing_deps = f.recursive_deps.uniq.reject do |dep|
|
|
dep.rack.exist? and dep.rack.subdirs.length > 0
|
|
end
|
|
|
|
unless missing_deps.empty?
|
|
yield f.name, missing_deps if block_given?
|
|
missing[f.name] = missing_deps
|
|
end
|
|
end
|
|
missing
|
|
end
|
|
|
|
def missing
|
|
return unless HOMEBREW_CELLAR.exist?
|
|
|
|
ff = if ARGV.named.empty?
|
|
installed_brews
|
|
else
|
|
ARGV.formulae
|
|
end
|
|
|
|
missing_deps(ff) do |name, missing|
|
|
print "#{name}: " if ff.size > 1
|
|
puts "#{missing * ' '}"
|
|
end
|
|
end
|
|
end
|