class Glooctl < Formula desc "Envoy-Powered API Gateway" homepage "https://gloo.solo.io" url "https://github.com/solo-io/gloo.git", :tag => "v0.21.0", :revision => "a9f165f840c35b25ab5d587c3fdf5b9233bb78c6" head "https://github.com/solo-io/gloo.git" bottle do cellar :any_skip_relocation sha256 "6c87a7a09eb05b12eaa612249731643147aaea6bee3a5bf43be23c101b8e4508" => :catalina sha256 "46029698e7332bdc6f6300386de9527fae4b42f81fae3d214a39eced8477c78a" => :mojave sha256 "fddb6f8007edeb093586329278715216ff4b7b404a56ac19868cf91d15cdeed0" => :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