31fe07ecd4
Closes Homebrew/homebrew#30064. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
47 lines
1.3 KiB
Ruby
47 lines
1.3 KiB
Ruby
require 'formula'
|
|
|
|
class Dos2unix < Formula
|
|
homepage 'http://waterlan.home.xs4all.nl/dos2unix.html'
|
|
url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-6.0.5.tar.gz'
|
|
sha1 'b43d138e1713791ea5067c32afbcd7a32655d2fa'
|
|
|
|
depends_on 'gettext'
|
|
|
|
devel do
|
|
url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-6.0.6-beta1.tar.gz'
|
|
sha1 '2ef5f0021c5a3f7a2e1a09faf33d5d410c18a44d'
|
|
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
|
|
# write a file with lf
|
|
path = testpath/"test.txt"
|
|
path.write "foo\nbar\n"
|
|
|
|
# unix2mac: convert lf to cr
|
|
system "#{bin}/unix2mac", path
|
|
assert_equal "foo\rbar\r", path.read
|
|
|
|
# mac2unix: convert cr to lf
|
|
system "#{bin}/mac2unix", path
|
|
assert_equal "foo\nbar\n", path.read
|
|
|
|
# unix2dos: convert lf to cr+lf
|
|
system "#{bin}/unix2dos", path
|
|
assert_equal "foo\r\nbar\r\n", path.read
|
|
|
|
# dos2unix: convert cr+lf to lf
|
|
system "#{bin}/dos2unix", path
|
|
assert_equal "foo\nbar\n", path.read
|
|
end
|
|
end
|