class KubernetesCli < Formula desc "Kubernetes command-line interface" homepage "https://kubernetes.io/" url "https://github.com/kubernetes/kubernetes.git", :tag => "v1.6.5", :revision => "490c6f13df1cb6612e0993c4c14f2ff90f8cdbf3" head "https://github.com/kubernetes/kubernetes.git" bottle do cellar :any_skip_relocation sha256 "ecd91c5e5f8b69712ef2db4760453da1063db6f03aa7ada30c6754b3097fda7d" => :sierra sha256 "adddf9e301d93ed6712ac4d34750da8f2372077fa5d1cc2d03ca34414cfaad18" => :el_capitan sha256 "a918332a18c8625125466f12b23a3deb99f49cf867a3d10f99688b0ee3726aad" => :yosemite 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 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