class KubernetesCli < Formula desc "Kubernetes command-line interface" homepage "https://kubernetes.io/" url "https://github.com/kubernetes/kubernetes.git", :tag => "v1.9.3", :revision => "d2835416544f298c919e2ead3be3d0864b52323b" head "https://github.com/kubernetes/kubernetes.git" bottle do cellar :any_skip_relocation sha256 "ee138a89c5a40a83f0a1d7f5ba8877597b92535174154bc3e8acba429ba42ab2" => :high_sierra sha256 "fd3d0a6c91585c7334990a645812df532396873e9f6f6ae33ed2a9fb8a1a109c" => :sierra sha256 "70f600bd7cefd0733ca95aa0e82d408d6b803774ad556974db899902802637dc" => :el_capitan end depends_on "go" => :build def install ENV["GOPATH"] = buildpath arch = MacOS.prefer_64_bit? ? "amd64" : "x86" dir = buildpath/"src/k8s.io/kubernetes" dir.install buildpath.children - [buildpath/".brew_home"] cd dir do # Race condition still exists in OSX Yosemite # Filed issue: https://github.com/kubernetes/kubernetes/issues/34635 ENV.deparallelize { system "make", "generated_files" } # Make binary system "make", "kubectl" bin.install "_output/local/bin/darwin/#{arch}/kubectl" # Install bash completion output = Utils.popen_read("#{bin}/kubectl completion bash") (bash_completion/"kubectl").write output # Install zsh completion output = Utils.popen_read("#{bin}/kubectl completion zsh") (zsh_completion/"_kubectl").write output prefix.install_metafiles # Install man pages # Leave this step for the end as this dirties the git tree system "hack/generate-docs.sh" man1.install Dir["docs/man/man1/*.1"] end end test do run_output = shell_output("#{bin}/kubectl 2>&1") assert_match "kubectl controls the Kubernetes cluster manager.", run_output version_output = shell_output("#{bin}/kubectl version --client 2>&1") assert_match "GitTreeState:\"clean\"", version_output assert_match stable.instance_variable_get(:@resource).instance_variable_get(:@specs)[:revision], version_output if build.stable? end end