class Ack < Formula desc "Search tool like grep, but optimized for programmers" homepage "https://beyondgrep.com/" url "https://beyondgrep.com/ack-2.22-single-file" version "2.22" sha256 "fd0617585b88517a3d41d3d206c1dc38058c57b90dfd88c278049a41aeb5be38" head "https://github.com/petdance/ack2.git", :branch => "dev" devel do url "https://beyondgrep.com/ack-2.999_03-single-file" version "2.999-03" sha256 "7e75bbe0baffac14aa7798198faa2184241990a72ff0150f157ef6296a148e3c" end bottle :unneeded resource "File::Next" do url "https://cpan.metacpan.org/authors/id/P/PE/PETDANCE/File-Next-1.16.tar.gz" sha256 "6965f25c2c132d0ba7a6f72b57b8bc6d25cf8c1b7032caa3a9bda8612e41d759" end def install if build.stable? || build.devel? bin.install "ack-#{version.to_s.tr("-", "_")}-single-file" => "ack" system "pod2man", "#{bin}/ack", "ack.1" man1.install "ack.1" else ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5" ENV.prepend_path "PERL5LIB", libexec/"lib" resource("File::Next").stage do system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}" system "make", "install" end system "perl", "Makefile.PL", "DESTDIR=#{buildpath}" system "make" libexec.install "ack" chmod 0755, libexec/"ack" (libexec/"lib").install "blib/lib/App" (bin/"ack").write_env_script("#{libexec}/ack", :PERL5LIB => ENV["PERL5LIB"]) man1.install "blib/man1/ack.1" end end test do assert_equal "foo bar\n", pipe_output("#{bin}/ack --noenv --nocolor bar -", "foo\nfoo bar\nbaz") end end