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"
|
2017-01-25 17:04:56 +00:00
|
|
|
url "https://github.com/awgn/cgrep/archive/v6.6.17.tar.gz"
|
|
|
|
sha256 "2508563701365d9b49c9a5610a4ff7ea3905b2d9cd77ac332f485322d93bcd07"
|
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
|
2017-01-25 23:05:34 +00:00
|
|
|
sha256 "8f3fcc507950c77381ec98e28806cc23851559975de8d71404697685a9e93fb6" => :sierra
|
|
|
|
sha256 "3576ca83c22cb12ad59b3c4821e7b474675a0167c711859ad4cf5c8774456d0f" => :el_capitan
|
|
|
|
sha256 "015553f35840cd8e3f88b231a90cee8ad96b90772356f411d87f40b50fc36863" => :yosemite
|
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
|