diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/readall.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index f43b30bfd..7bb921b88 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -5,9 +5,31 @@ require 'formula' require 'cmd/tap' +require 'thread' module Homebrew def readall + 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 + rescue ThreadError, IOError # ignore empty queue error + end + end + end + workers.map(&:join) + Homebrew.failed = failed + end + formulae = [] if ARGV.empty? formulae = Formula.names |
