class Glooctl < Formula desc "Envoy-Powered API Gateway" homepage "https://gloo.solo.io" url "https://github.com/solo-io/gloo.git", :tag => "v0.20.13", :revision => "bc3835e66855758ab7ffaa53c30fb75f57365546" head "https://github.com/solo-io/gloo.git" bottle do cellar :any_skip_relocation sha256 "49e4c484acccd9f3ba43c9dd7e2a8c148935eb02cdab81f03c6ac60994161ec3" => :catalina sha256 "aaa18b0727fb24984c430e7bd0769d7c7f8f19ef6313fc6f2578178f065d54aa" => :mojave sha256 "c5766964060f3cbb72875dccbb59ee7626819d705f611348af4e93b62a623417" => :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