2010-09-25 12:49:09 +01:00
|
|
|
require 'formula'
|
|
|
|
|
2010-09-11 20:22:54 +01:00
|
|
|
module Homebrew extend self
|
|
|
|
def deps
|
2010-09-25 12:49:09 +01:00
|
|
|
if ARGV.include? '--all'
|
|
|
|
Formula.each do |f|
|
2011-06-15 09:02:18 -07:00
|
|
|
puts "#{f.name}: #{f.deps*' '}"
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
else
|
2011-04-13 13:10:25 -07:00
|
|
|
all_deps = ARGV.formulae.map{ |f| ARGV.one? ? f.deps : f.recursive_deps }.intersection
|
|
|
|
all_deps.sort! unless ARGV.include? "-n"
|
|
|
|
puts all_deps
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-09-25 12:49:09 +01:00
|
|
|
|
|
|
|
class Array
|
|
|
|
def intersection
|
|
|
|
a = []
|
|
|
|
each{ |b| a |= b }
|
|
|
|
each{ |c| a &= c }
|
|
|
|
a
|
|
|
|
end
|
|
|
|
end
|