cmd/readall: add --syntax to check for valid Ruby.
This commit is contained in:
parent
3b15382029
commit
d5f55334f1
@ -5,9 +5,31 @@
|
|||||||
|
|
||||||
require 'formula'
|
require 'formula'
|
||||||
require 'cmd/tap'
|
require 'cmd/tap'
|
||||||
|
require 'thread'
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def readall
|
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 = []
|
formulae = []
|
||||||
if ARGV.empty?
|
if ARGV.empty?
|
||||||
formulae = Formula.names
|
formulae = Formula.names
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user