class Glooctl < Formula desc "Envoy-Powered API Gateway" homepage "https://docs.solo.io/gloo/latest/" url "https://github.com/solo-io/gloo.git", :tag => "v1.2.12", :revision => "a1ad17b6bad6efeb8841a4f56134e16da75ae8f8" head "https://github.com/solo-io/gloo.git" bottle do cellar :any_skip_relocation sha256 "22f65ac0ef7d2aacc8074e23169085d9f3f1a03c19f72720ef88e9ee0b9edde0" => :catalina sha256 "b1132435d1101c69413c8f79b7076ce918e03178bc82a00ca0eaef9a0817d1bb" => :mojave sha256 "27f074056a39915b64522b003b9f6baa9c00ab3941537a156c84e2d2bb7f383b" => :high_sierra end depends_on "dep" => :build depends_on "go" => :build def install ENV["GOPATH"] = buildpath dir = buildpath/"src/github.com/solo-io/gloo" dir.install buildpath.children - [buildpath/".brew_home"] cd dir do system "dep", "ensure", "-vendor-only" system "make", "glooctl", "TAGGED_VERSION=v#{version}" bin.install "_output/glooctl" end end test do run_output = shell_output("#{bin}/glooctl 2>&1") assert_match "glooctl is the unified CLI for Gloo.", run_output version_output = shell_output("#{bin}/glooctl version 2>&1") assert_match "Client: {\"version\":\"#{version}\"}", version_output version_output = shell_output("#{bin}/glooctl version 2>&1") assert_match "Server: version undefined", version_output # Should error out as it needs access to a Kubernetes cluster to operate correctly status_output = shell_output("#{bin}/glooctl get proxy 2>&1", 1) assert_match "failed to create proxy client", status_output end end