2014-06-29 02:34:13 +00:00
|
|
|
require "formula"
|
|
|
|
|
|
|
|
class ThePlatinumSearcher < Formula
|
|
|
|
homepage "https://github.com/monochromegane/the_platinum_searcher"
|
2014-07-07 20:08:15 +00:00
|
|
|
url "https://github.com/monochromegane/the_platinum_searcher/archive/v1.6.4.tar.gz"
|
|
|
|
sha1 "362df20068c9ea19dfb3126c267012356dc7958c"
|
2014-06-29 02:34:13 +00:00
|
|
|
head "https://github.com/monochromegane/the_platinum_searcher.git"
|
|
|
|
|
|
|
|
depends_on "go" => :build
|
|
|
|
depends_on :hg => :build
|
|
|
|
|
2014-06-30 07:05:12 +00:00
|
|
|
bottle do
|
|
|
|
sha1 "ea198486a8ae7d8fcb4990981aee01b6867e7311" => :mavericks
|
|
|
|
sha1 "f71a8d2dcb9573d1202b2c2493230d5d0ab383ab" => :mountain_lion
|
|
|
|
sha1 "bfdc5095cfbf3e38ca7900b3fb5dad1ec10f089d" => :lion
|
|
|
|
end
|
|
|
|
|
2014-06-29 02:34:13 +00:00
|
|
|
def install
|
|
|
|
(buildpath + "src/github.com/monochromegane/the_platinum_searcher").install "search"
|
|
|
|
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
|
|
|
|
system "go", "get", "github.com/shiena/ansicolor"
|
|
|
|
system "go", "get", "github.com/monochromegane/terminal"
|
|
|
|
system "go", "get", "github.com/jessevdk/go-flags"
|
|
|
|
system "go", "get", "code.google.com/p/go.text/transform"
|
|
|
|
|
|
|
|
system "go", "build", "-o", "pt"
|
|
|
|
bin.install "pt"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
path = testpath/"hello_world.txt"
|
|
|
|
data = "Hello World!"
|
|
|
|
path.open("wb") { |f| f.write data}
|
|
|
|
|
2014-07-07 20:08:15 +00:00
|
|
|
lines = `#{bin}/pt 'Hello World!' #{path}`.strip.split(":")
|
|
|
|
assert_equal "Hello World!", lines[2]
|
2014-06-29 02:34:13 +00:00
|
|
|
end
|
|
|
|
end
|