2014-06-29 02:34:13 +00:00
|
|
|
require "formula"
|
2014-09-07 18:09:07 +00:00
|
|
|
require "language/go"
|
2014-06-29 02:34:13 +00:00
|
|
|
|
|
|
|
class ThePlatinumSearcher < Formula
|
|
|
|
homepage "https://github.com/monochromegane/the_platinum_searcher"
|
2014-09-07 18:09:07 +00:00
|
|
|
url "https://github.com/monochromegane/the_platinum_searcher/archive/v1.7.1.tar.gz"
|
|
|
|
sha1 "5e2d704e0c0d8380c82e55a30b7d0fc749ab0c55"
|
2014-06-29 02:34:13 +00:00
|
|
|
head "https://github.com/monochromegane/the_platinum_searcher.git"
|
|
|
|
|
2014-09-07 18:09:07 +00:00
|
|
|
go_resource "github.com/jessevdk/go-flags" do
|
|
|
|
url "https://github.com/jessevdk/go-flags.git",
|
|
|
|
:revision => "7047cf7a8dc6f41e53365420ab62d415055232c6"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/monochromegane/terminal" do
|
|
|
|
url "https://github.com/monochromegane/terminal.git",
|
|
|
|
:revision => "6d255869fb99937f1f287bd1fe3a034c6c4f68f6"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/shiena/ansicolor" do
|
|
|
|
url "https://github.com/shiena/ansicolor.git",
|
|
|
|
:revision => "6046e7d18a7698e98846e5d25842e9cf15aecf2c"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "code.google.com/p/go.text" do
|
|
|
|
url "https://code.google.com/p/go.text", :using => :hg,
|
|
|
|
:revision => "46250cb715a27b42c736a5ff2a4e6fa0b2118952"
|
|
|
|
end
|
|
|
|
|
2014-06-29 02:34:13 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
2014-06-30 07:05:12 +00:00
|
|
|
bottle do
|
2014-09-07 18:09:07 +00:00
|
|
|
sha1 "511db4d641eda8dc72afbba8e0310a0a18f55462" => :mavericks
|
|
|
|
sha1 "7ee22e93f06a692ba6c3095b892b877d29135c08" => :mountain_lion
|
|
|
|
sha1 "1ae1fadd1e0955c0d913a9bbf0b28e3b04c11040" => :lion
|
2014-06-30 07:05:12 +00:00
|
|
|
end
|
|
|
|
|
2014-06-29 02:34:13 +00:00
|
|
|
def install
|
2014-09-07 18:09:07 +00:00
|
|
|
# configure buildpath for local dependencies
|
|
|
|
mkdir_p buildpath/"src/github.com/monochromegane"
|
|
|
|
ln_s buildpath, buildpath/"src/github.com/monochromegane/the_platinum_searcher"
|
2014-06-29 02:34:13 +00:00
|
|
|
|
|
|
|
ENV["GOPATH"] = buildpath
|
2014-09-07 18:09:07 +00:00
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
2014-06-29 02:34:13 +00:00
|
|
|
|
2014-09-07 18:09:07 +00:00
|
|
|
system "go", "build", "-o", "pt", "cmd/pt/main.go"
|
2014-06-29 02:34:13 +00:00
|
|
|
bin.install "pt"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
path = testpath/"hello_world.txt"
|
2014-07-16 21:50:31 +00:00
|
|
|
path.write "Hello World!"
|
2014-06-29 02:34:13 +00:00
|
|
|
|
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
|