blob: 67d10d11fd191875f388783d1e7caf59c6833bf3 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 | require 'formula'
require 'tab'
module Homebrew
  def missing_deps ff
    missing = {}
    ff.each do |f|
      missing_deps = f.recursive_dependencies do |dependent, dep|
        if dep.optional? || dep.recommended?
          tab = Tab.for_formula(dependent)
          Dependency.prune unless tab.with?(dep)
        elsif dep.build?
          Dependency.prune
        end
      end
      missing_deps.map!(&:to_formula)
      missing_deps.reject! { |d| d.rack.exist? && d.rack.subdirs.length > 0 }
      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?
      Formula.installed
    else
      ARGV.formulae
    end
    missing_deps(ff) do |name, missing|
      print "#{name}: " if ff.size > 1
      puts "#{missing * ' '}"
    end
  end
end
 |