aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Contributions/examples/brew-missing.rb
blob: 701bb1ca2891bee5a7a49f21d444311e342c16bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require "formula"
require "cmd/outdated"

def main
  # Names of outdated brews; they count as installed.
  outdated = Homebrew.outdated_brews.collect{ |b| b[1] }

  HOMEBREW_CELLAR.subdirs.each do |rack|
    f = Formula.factory rack.basename.to_s rescue nil
    if f and f.installed?
      missing_deps = f.recursive_deps.map{ |g| g.name }.uniq.reject do |dep_name|
        Formula.factory(dep_name).installed? or outdated.include?(dep_name)
      end

      puts "#{f.name}: #{missing_deps * ', '}" unless missing_deps.empty?
    end
  end
end

main()