Andrew Janke a3b70d38a7 brew-audit: pull style checks in to main audit output
This collects all violations for each formula in a single place, instead
of doing `brew style` outputs for all formulae first, and then the other
audit checks.

Closes #112.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-21 14:45:33 -04:00

29 lines
513 B
Ruby

module Utils
def self.popen_read(*args, &block)
popen(args, "rb", &block)
end
def self.popen_read_text(*args, &block)
popen(args, "r", &block)
end
def self.popen_write(*args, &block)
popen(args, "wb", &block)
end
def self.popen(args, mode)
IO.popen("-", mode) do |pipe|
if pipe
if block_given?
yield pipe
else
return pipe.read
end
else
STDERR.reopen("/dev/null", "w")
exec(*args)
end
end
end
end