2016-08-31 09:55:00 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Gron < Formula
|
|
|
|
desc "Make JSON greppable"
|
|
|
|
homepage "https://github.com/tomnomnom/gron"
|
2017-02-03 05:40:40 +00:00
|
|
|
url "https://github.com/tomnomnom/gron/archive/v0.4.0.tar.gz"
|
|
|
|
sha256 "e9c1c071f34a7a04eec61bbe95e9d5cc078cc03adcf600945fd01448d42646ed"
|
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
|
2017-02-03 06:33:22 +00:00
|
|
|
sha256 "72c06e0f5f429b505edf12ef4286bee205c3805815e3ef9672be88696d8a9000" => :sierra
|
|
|
|
sha256 "af5dd44dd022ea9e84d66e8a904596b35561174959188c2c05314fabd0ceda84" => :el_capitan
|
|
|
|
sha256 "88abd47eddfef7782733fa7200393a47f4b56367396d39d2166623d467ad90f0" => :yosemite
|
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",
|
2017-02-03 05:40:40 +00:00
|
|
|
:revision => "34e4ee095d12986a2cef5ddb9aeb3b8cfcfea17c"
|
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-24 15:45:48 +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-24 15:45:48 +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",
|
2017-02-03 05:40:40 +00:00
|
|
|
:revision => "0192e84d44af834c3a90c8a17bf670483b91ad5a"
|
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",
|
2017-02-03 05:40:40 +00:00
|
|
|
:revision => "645ef00459ed84a119197bfb8d8205042c6df63d"
|
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
|