2010-07-04 09:56:50 -07:00
|
|
|
# `brew readall` tries to import all formulae one-by-one.
|
|
|
|
# This can be useful for debugging issues across all formulae
|
2010-07-18 14:20:54 -07:00
|
|
|
# when making significant changes to formula.rb,
|
|
|
|
# or to determine if any current formulae have Ruby issues
|
2010-07-04 09:56:50 -07:00
|
|
|
|
|
|
|
require 'formula'
|
2014-04-13 16:25:46 +01:00
|
|
|
require 'cmd/tap'
|
2015-03-07 11:55:14 +00:00
|
|
|
require 'thread'
|
2014-04-13 16:25:46 +01:00
|
|
|
|
2014-04-27 19:45:18 -05:00
|
|
|
module Homebrew
|
|
|
|
def readall
|
2015-03-07 11:55:14 +00:00
|
|
|
if ARGV.delete("--syntax")
|
|
|
|
ruby_files = Queue.new
|
|
|
|
Dir.glob("#{HOMEBREW_LIBRARY}/Homebrew/**/*.rb").each do |rb|
|
|
|
|
ruby_files << rb
|
|
|
|
end
|
|
|
|
|
|
|
|
failed = false
|
|
|
|
workers = (0...Hardware::CPU.cores).map do
|
|
|
|
Thread.new do
|
|
|
|
begin
|
|
|
|
while rb = ruby_files.pop(true)
|
|
|
|
nostdout { failed = true unless system "ruby", "-c", "-w", rb }
|
|
|
|
end
|
2015-03-20 16:59:21 +00:00
|
|
|
rescue ThreadError # ignore empty queue error
|
2015-03-07 11:55:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
workers.map(&:join)
|
|
|
|
Homebrew.failed = failed
|
|
|
|
end
|
|
|
|
|
2014-04-27 19:45:18 -05:00
|
|
|
formulae = []
|
2015-04-11 14:18:13 +01:00
|
|
|
if ARGV.named.empty?
|
2015-05-08 19:54:29 +08:00
|
|
|
formulae = Formula.full_names
|
2014-04-27 19:45:18 -05:00
|
|
|
else
|
2015-06-08 18:05:58 +08:00
|
|
|
tap = Tap.new(*tap_args)
|
2015-06-13 14:32:10 +08:00
|
|
|
raise TapUnavailableError, tap.name unless tap.installed?
|
2015-06-08 18:05:58 +08:00
|
|
|
formulae = tap.formula_files
|
2014-04-27 19:45:18 -05:00
|
|
|
end
|
2014-04-13 16:25:46 +01:00
|
|
|
|
2014-04-27 19:45:18 -05:00
|
|
|
formulae.sort.each do |n|
|
|
|
|
begin
|
2014-06-22 15:00:15 -05:00
|
|
|
Formulary.factory(n)
|
2014-04-27 19:45:18 -05:00
|
|
|
rescue Exception => e
|
2015-05-08 13:48:36 +08:00
|
|
|
onoe "problem in #{Formulary.path(n)}"
|
2014-04-27 19:45:18 -05:00
|
|
|
puts e
|
|
|
|
Homebrew.failed = true
|
|
|
|
end
|
|
|
|
end
|
2010-07-18 14:20:54 -07:00
|
|
|
end
|
|
|
|
end
|