require "language/go" class Gron < Formula desc "Make JSON greppable" homepage "https://github.com/tomnomnom/gron" url "https://github.com/tomnomnom/gron/archive/v0.4.0.tar.gz" sha256 "e9c1c071f34a7a04eec61bbe95e9d5cc078cc03adcf600945fd01448d42646ed" head "https://github.com/tomnomnom/gron.git" bottle do cellar :any_skip_relocation sha256 "72c06e0f5f429b505edf12ef4286bee205c3805815e3ef9672be88696d8a9000" => :sierra sha256 "af5dd44dd022ea9e84d66e8a904596b35561174959188c2c05314fabd0ceda84" => :el_capitan sha256 "88abd47eddfef7782733fa7200393a47f4b56367396d39d2166623d467ad90f0" => :yosemite end depends_on "go" => :build go_resource "github.com/fatih/color" do url "https://github.com/fatih/color.git", :revision => "34e4ee095d12986a2cef5ddb9aeb3b8cfcfea17c" end go_resource "github.com/mattn/go-colorable" do url "https://github.com/mattn/go-colorable.git", :revision => "ed8eb9e318d7a84ce5915b495b7d35e0cfe7b5a8" end go_resource "github.com/mattn/go-isatty" do url "https://github.com/mattn/go-isatty.git", :revision => "3a115632dcd687f9c8cd01679c83a06a0e21c1f3" end go_resource "github.com/nwidger/jsoncolor" do url "https://github.com/nwidger/jsoncolor.git", :revision => "0192e84d44af834c3a90c8a17bf670483b91ad5a" end go_resource "github.com/pkg/errors" do url "https://github.com/pkg/errors.git", :revision => "645ef00459ed84a119197bfb8d8205042c6df63d" end def install ENV["GOPATH"] = buildpath (buildpath/"src/github.com/tomnomnom").mkpath ln_s buildpath, buildpath/"src/github.com/tomnomnom/gron" 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