From 71cd498df8c9da408c45ad9b2b470f630912fe85 Mon Sep 17 00:00:00 2001 From: David Larson Date: Sat, 28 Jun 2014 19:34:13 -0700 Subject: [PATCH] the_platinum_searcher 1.6.4 (new formula) `the_platinum_searcher` (`pt`) is code search tool, similar to `ack` and `the_silver_searcher` (`ag`), but is written in Go to enable easier multi-platform support. --- Formula/the_platinum_searcher.rb | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Formula/the_platinum_searcher.rb diff --git a/Formula/the_platinum_searcher.rb b/Formula/the_platinum_searcher.rb new file mode 100644 index 00000000000..418de40d761 --- /dev/null +++ b/Formula/the_platinum_searcher.rb @@ -0,0 +1,34 @@ +require "formula" + +class ThePlatinumSearcher < Formula + homepage "https://github.com/monochromegane/the_platinum_searcher" + url "https://github.com/monochromegane/the_platinum_searcher/archive/v1.6.4.tar.gz" + sha1 "362df20068c9ea19dfb3126c267012356dc7958c" + head "https://github.com/monochromegane/the_platinum_searcher.git" + + depends_on "go" => :build + depends_on :hg => :build + + 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} + + lines = `#{bin}/pt 'Hello World!' #{path}`.strip.split(":") + assert_equal "Hello World!", lines[2] + end +end