Skip to content
Snippets Groups Projects
Commit d5f55334 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

cmd/readall: add --syntax to check for valid Ruby.

parent 3b153820
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment