Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (46 sloc) 1.61 KB
class Grep < Formula
desc "GNU grep, egrep and fgrep"
homepage "https://www.gnu.org/software/grep/"
url "https://ftpmirror.gnu.org/grep/grep-2.27.tar.xz"
mirror "https://ftp.gnu.org/gnu/grep/grep-2.27.tar.xz"
sha256 "ad4cc44d23074a1c3a8baae8fbafff2a8c60f38a9a6108f985eef6fbee6dcaeb"
bottle do
cellar :any
sha256 "b6edf262b5d8f8ee1677075c9bbccd26572848e5788555080bff811f68f34068" => :sierra
sha256 "889b978e2cbc872a82b24dacc5e2f8c0f44b54524f91828422ae28ceba2553b4" => :el_capitan
sha256 "cb57cd9a8d15161b1bfa0f0241f0ee52277ad588ff42118a1e0ee55406f48dad" => :yosemite
end
option "with-default-names", "Do not prepend 'g' to the binary"
deprecated_option "default-names" => "with-default-names"
depends_on "pkg-config" => :build
depends_on "pcre"
def install
args = %W[
--disable-dependency-tracking
--disable-nls
--prefix=#{prefix}
--infodir=#{info}
--mandir=#{man}
--with-packager=Homebrew
]
args << "--program-prefix=g" if build.without? "default-names"
system "./configure", *args
system "make"
system "make", "install"
end
def caveats
if build.without? "default-names" then <<-EOS.undent
The command has been installed with the prefix "g".
If you do not want the prefix, install using the "with-default-names"
option.
EOS
end
end
test do
text_file = testpath/"file.txt"
text_file.write "This line should be matched"
cmd = build.with?("default-names") ? "grep" : "ggrep"
grepped = shell_output("#{bin}/#{cmd} match #{text_file}")
assert_match "should be matched", grepped
end
end