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|
|
|
|
|
# TODO add a space after the colon??
|
|
|
|
puts "#{f.name}:#{f.deps*' '}"
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
else
|
2010-09-25 12:49:09 +01:00
|
|
|
func = if ARGV.one? then :deps else :recursive_deps end
|
|
|
|
puts ARGV.formulae.map(&func).intersection.sort
|
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
|