2016-08-31 09:55:00 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Gron < Formula
|
|
|
|
desc "Make JSON greppable"
|
|
|
|
homepage "https://github.com/tomnomnom/gron"
|
2016-09-10 09:36:37 +00:00
|
|
|
url "https://github.com/tomnomnom/gron/archive/v0.3.6.tar.gz"
|
|
|
|
sha256 "b627efa5bcc6157386a5732aad6a0cc890342dc4c662e837b6d62fd527a4d5f4"
|
2016-08-31 09:55:00 +00:00
|
|
|
head "https://github.com/tomnomnom/gron.git"
|
|
|
|
|
2016-09-01 01:51:34 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2016-09-10 10:10:23 +00:00
|
|
|
sha256 "5dabf7c846ad10c9a1c1af80ee6dad53483bf5422503a4dc6357d9d9b73dec3a" => :el_capitan
|
|
|
|
sha256 "9f7370ec6972aeab61929c5cf226a96b7c6059a37079ed28fd2858f1bd68ef7d" => :yosemite
|
|
|
|
sha256 "72c982d9f74f78651f6b95e7c6ea7ecd765c6667661d9f481fd0a86984439f3d" => :mavericks
|
2016-09-01 01:51:34 +00:00
|
|
|
end
|
|
|
|
|
2016-08-31 09:55:00 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
go_resource "github.com/fatih/color" do
|
|
|
|
url "https://github.com/fatih/color.git",
|
2016-09-09 07:36:00 +00:00
|
|
|
:revision => "87d4004f2ab62d0d255e0a38f1680aa534549fe3"
|
2016-08-31 09:55:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mattn/go-colorable" do
|
|
|
|
url "https://github.com/mattn/go-colorable.git",
|
2016-09-09 07:36:00 +00:00
|
|
|
:revision => "ed8eb9e318d7a84ce5915b495b7d35e0cfe7b5a8"
|
2016-08-31 09:55:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mattn/go-isatty" do
|
|
|
|
url "https://github.com/mattn/go-isatty.git",
|
2016-09-09 07:36:00 +00:00
|
|
|
:revision => "3a115632dcd687f9c8cd01679c83a06a0e21c1f3"
|
2016-08-31 09:55:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/nwidger/jsoncolor" do
|
|
|
|
url "https://github.com/nwidger/jsoncolor.git",
|
2016-09-09 07:36:00 +00:00
|
|
|
:revision => "f344a1ffbe51794516e9cf2c4d58b203863d3070"
|
2016-08-31 09:55:00 +00:00
|
|
|
end
|
|
|
|
|
2016-09-07 21:25:10 +00:00
|
|
|
go_resource "github.com/pkg/errors" do
|
|
|
|
url "https://github.com/pkg/errors.git",
|
2016-09-09 07:36:00 +00:00
|
|
|
:revision => "17b591df37844cde689f4d5813e5cea0927d8dd2"
|
2016-09-07 21:25:10 +00:00
|
|
|
end
|
|
|
|
|
2016-08-31 09:55:00 +00:00
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
2016-09-10 09:36:37 +00:00
|
|
|
(buildpath/"src/github.com/tomnomnom").mkpath
|
|
|
|
ln_s buildpath, buildpath/"src/github.com/tomnomnom/gron"
|
2016-08-31 09:55:00 +00:00
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
system "go", "build", "-o", bin/"gron"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
assert_equal <<-EOS.undent, pipe_output("#{bin}/gron", "{\"foo\":1, \"bar\":2}")
|
|
|
|
json = {};
|
|
|
|
json.bar = 2;
|
|
|
|
json.foo = 1;
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|