2014-08-22 02:47:03 +00:00
|
|
|
require "formula"
|
2009-06-08 15:00:25 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Dos2unix < Formula
|
2014-08-22 02:47:03 +00:00
|
|
|
homepage "http://waterlan.home.xs4all.nl/dos2unix.html"
|
2015-02-20 22:10:53 +00:00
|
|
|
url "http://waterlan.home.xs4all.nl/dos2unix/dos2unix-7.2.tar.gz"
|
|
|
|
mirror "https://downloads.sourceforge.net/project/dos2unix/dos2unix/7.2/dos2unix-7.2.tar.gz"
|
|
|
|
sha1 "a8f3d048859acb5483c8e15a1dfd0a01a2bcabe0"
|
2009-06-08 15:00:25 +00:00
|
|
|
|
2014-09-27 18:18:57 +00:00
|
|
|
bottle do
|
2015-02-20 22:24:35 +00:00
|
|
|
sha1 "cf86c34ea9d8f2fefae59967deed0fd7364a04ae" => :yosemite
|
|
|
|
sha1 "a11ddbb12f414bd017aa53957f255fad58677878" => :mavericks
|
|
|
|
sha1 "3a7e49a6b78bffda1ead127b185e9a24ee14655e" => :mountain_lion
|
2014-09-27 18:18:57 +00:00
|
|
|
end
|
|
|
|
|
2014-08-22 02:47:03 +00:00
|
|
|
depends_on "gettext"
|
2011-06-29 15:47:52 +00:00
|
|
|
|
2009-06-08 15:00:25 +00:00
|
|
|
def install
|
2014-02-25 05:19:22 +00:00
|
|
|
gettext = Formula["gettext"]
|
2012-08-13 14:36:30 +00:00
|
|
|
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"
|
2009-06-08 15:00:25 +00:00
|
|
|
end
|
2014-01-14 02:54:53 +00:00
|
|
|
|
|
|
|
test do
|
2014-04-09 20:10:32 +00:00
|
|
|
# write a file with lf
|
2014-04-08 17:58:44 +00:00
|
|
|
path = testpath/"test.txt"
|
2014-04-09 20:10:32 +00:00
|
|
|
path.write "foo\nbar\n"
|
2014-04-08 17:58:44 +00:00
|
|
|
|
2014-04-09 20:10:32 +00:00
|
|
|
# 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
|
2014-04-08 17:58:44 +00:00
|
|
|
system "#{bin}/dos2unix", path
|
|
|
|
assert_equal "foo\nbar\n", path.read
|
2014-01-14 02:54:53 +00:00
|
|
|
end
|
2009-06-08 15:00:25 +00:00
|
|
|
end
|