homebrew-core/Formula/dos2unix.rb
Mike Naberezny 278f993c07 dos2unix: improve test by reusing pathname and checking all output
Closes Homebrew/homebrew#28254.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-04-08 19:15:41 +01:00

33 lines
905 B
Ruby

require 'formula'
class Dos2unix < Formula
homepage 'http://waterlan.home.xs4all.nl/dos2unix.html'
url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-6.0.4.tar.gz'
sha1 '93d73148c09908a42dcbf5339312c9aa1f18ba7c'
depends_on 'gettext'
devel do
url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-6.0.5-beta11.tar.gz'
sha1 'f7d17dc4dbf723c81d1459b9664fc8045a77541d'
end
def install
gettext = Formula["gettext"]
system "make", "prefix=#{prefix}",
"CC=#{ENV.cc}",
"CPP=#{ENV.cc}",
"CFLAGS=#{ENV.cflags}",
"CFLAGS_OS=-I#{gettext.include}",
"LDFLAGS_EXTRA=-L#{gettext.lib} -lintl",
"install"
end
test do
path = testpath/"test.txt"
path.write "foo\r\nbar\r\n"
system "#{bin}/dos2unix", path
assert_equal "foo\nbar\n", path.read
end
end