2014-06-21 08:38:24 +00:00
|
|
|
require "language/haskell"
|
|
|
|
|
|
|
|
class Cgrep < Formula
|
|
|
|
include Language::Haskell::Cabal
|
|
|
|
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Context-aware grep for source code"
|
2014-06-21 08:38:24 +00:00
|
|
|
homepage "https://github.com/awgn/cgrep"
|
2016-06-14 11:45:32 +00:00
|
|
|
url "https://hackage.haskell.org/package/cgrep-6.6.15/cgrep-6.6.15.tar.gz"
|
|
|
|
sha256 "f58a557fecdc7066ec60653e7c902b8baedcf4f44a81f890265374b6dab9affa"
|
2014-12-03 22:44:40 +00:00
|
|
|
head "https://github.com/awgn/cgrep.git"
|
2014-06-21 08:38:24 +00:00
|
|
|
|
2014-06-21 13:24:52 +00:00
|
|
|
bottle do
|
2016-06-14 12:26:16 +00:00
|
|
|
sha256 "1317722acff1a6cd85f28e6fd053ae970a737aa83adcbf1385a4cd02a03629ee" => :el_capitan
|
|
|
|
sha256 "c77f375e2aa5672a3c2d1a09fbced92ec61030010bbe7a0a92ddbebaec69c122" => :yosemite
|
|
|
|
sha256 "5b6562ffc2f147e4e5ce913a78cc94378119e01b2f4bd9f9ef295caaf0859b18" => :mavericks
|
2014-06-21 13:24:52 +00:00
|
|
|
end
|
|
|
|
|
2014-06-21 08:38:24 +00:00
|
|
|
depends_on "ghc" => :build
|
|
|
|
depends_on "cabal-install" => :build
|
2015-10-28 13:29:28 +00:00
|
|
|
depends_on "pcre"
|
2014-06-21 08:38:24 +00:00
|
|
|
|
|
|
|
def install
|
2015-10-28 13:29:28 +00:00
|
|
|
install_cabal_package
|
2014-06-21 08:38:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
path = testpath/"test.rb"
|
|
|
|
path.write <<-EOS.undent
|
2015-10-28 13:29:28 +00:00
|
|
|
# puts test comment.
|
|
|
|
puts "test literal."
|
2014-06-21 08:38:24 +00:00
|
|
|
EOS
|
|
|
|
|
2015-10-28 13:29:28 +00:00
|
|
|
assert_match ":1",
|
|
|
|
shell_output("script -q /dev/null #{bin}/cgrep --count --comment test #{path}")
|
|
|
|
assert_match ":1",
|
|
|
|
shell_output("script -q /dev/null #{bin}/cgrep --count --literal test #{path}")
|
|
|
|
assert_match ":1",
|
|
|
|
shell_output("script -q /dev/null #{bin}/cgrep --count --code puts #{path}")
|
2014-06-21 08:38:24 +00:00
|
|
|
end
|
|
|
|
end
|