2011-11-12 17:23:20 +00:00
|
|
|
class Bgrep < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Like grep but for binary strings"
|
2015-08-03 12:55:31 +00:00
|
|
|
homepage "https://github.com/tmbinc/bgrep"
|
|
|
|
url "https://github.com/tmbinc/bgrep/archive/bgrep-0.2.tar.gz"
|
|
|
|
sha256 "24c02393fb436d7a2eb02c6042ec140f9502667500b13a59795388c1af91f9ba"
|
2011-11-12 17:23:20 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
system "#{ENV.cc} #{ENV.cflags} -o bgrep bgrep.c"
|
|
|
|
bin.install "bgrep"
|
|
|
|
end
|
2014-02-06 20:05:53 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
path = testpath/"hi.prg"
|
2014-05-04 19:12:41 +00:00
|
|
|
path.binwrite [0x00, 0xc0, 0xa9, 0x48, 0x20, 0xd2, 0xff,
|
|
|
|
0xa9, 0x49, 0x20, 0xd2, 0xff, 0x60].pack("C*")
|
2014-02-06 20:05:53 +00:00
|
|
|
|
2014-05-04 19:12:41 +00:00
|
|
|
assert_equal ["#{path}: 00000004", "#{path}: 00000009"],
|
|
|
|
shell_output("#{bin}/bgrep 20d2ff #{path}").split("\n")
|
2014-02-06 20:05:53 +00:00
|
|
|
end
|
2011-11-12 17:23:20 +00:00
|
|
|
end
|