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