brew/Library/Contributions/cmd/brew-readall.rb
Mike McQuaid 2d155f2d41 readall: read formulae that aren't tapped.
This will allow the reading and checking of formulae that mirror
Homebrew core formulae (e.g. `git` in a tap) and, with the previous exit
code changes, is a reasonable check for "are all the formulae in taps
updated to the latest core DSL".

Closes Homebrew/homebrew#28328.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-04-13 19:18:38 +01:00

32 lines
809 B
Ruby
Executable File

# `brew readall` tries to import all formulae one-by-one.
# This can be useful for debugging issues across all formulae
# when making significant changes to formula.rb,
# or to determine if any current formulae have Ruby issues
require 'formula'
require 'cmd/tap'
formulae = []
if ARGV.empty?
formulae = Formula.names
else
tap_name = ARGV.first
# Allow use of e.g. homebrew/versions or homebrew-versions
tap_dir = tap_name.reverse.sub('/', '-').reverse
tap = Pathname("#{HOMEBREW_LIBRARY}/Taps/#{tap_dir}")
raise "#{tap} does not exist!" unless tap.exist?
tap.find_formula do |f|
formulae << (tap/f).tap_ref
end
end
formulae.sort.each do |n|
begin
Formula.factory(n)
rescue Exception => e
onoe "problem in #{Formula.path(n)}"
puts e
Homebrew.failed = true
end
end