homebrew-core/Formula/audiofile.rb
Jack Nagel 7c648d9732 Shore up a number of shell quoting issues
When interpolating in strings passed to Formula#system, it should be
done in such a way that if any interpolated variables contain spaces,
they are either (a) passed as part of a list or (b) protected by quotes
if they are part of a long string (which is subject to shell expansion).
Otherwise, they will be split on the space when expanded by the shell
and passed as multiple arguments to whatever process is being executed.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-15 14:03:11 -05:00

55 lines
1.5 KiB
Ruby

require 'formula'
class Audiofile < Formula
url 'https://github.com/downloads/mpruett/audiofile/audiofile-0.3.2.tar.gz'
sha1 'fb55a3c9153475daa8932d3626797e033d149c1d'
homepage 'http://www.68k.org/~michael/audiofile/'
depends_on 'lcov' if ARGV.include? '--with-lcov'
def options
[
['--with-lcov', 'Enable Code Coverage support using lcov.'],
['--with-check', 'Run the test suite during install ~30sec']
]
end
def install
args = ["--prefix=#{prefix}", "--disable-dependency-tracking"]
args << '--enable-coverage' if ARGV.include? '--with-lcov'
system "./configure", *args
system "make"
system "make check" if ARGV.include? '--with-check'
system "make install"
end
def test
inn = '/System/Library/Sounds/Glass.aiff'
out = 'Glass.wav'
hear_bin = '/usr/bin/qlmanage'
conv_bin = "#{bin}/sfconvert"
info_bin = "#{bin}/sfinfo"
unless File.exist?(conv_bin) and File.exist?(inn) and
File.exist?(hear_bin) and File.exist?(info_bin)
opoo <<-EOS.undent
One of the following files could not be located, and so
the test was not executed:
#{inn}
#{conv_bin}
#{info_bin}
#{hear_bin}
Audiofile can also be tested at build-time:
brew install -v audiofile --with-check
EOS
return
end
mktemp do
system conv_bin, inn, out, 'format', 'wave'
system info_bin, '--short', '--reporterror', out
system hear_bin, '-p', out if ARGV.verbose?
end
end
end