58 lines
2.1 KiB
Ruby
58 lines
2.1 KiB
Ruby
class KubernetesCli < Formula
|
|
desc "Kubernetes command-line interface"
|
|
homepage "https://kubernetes.io/"
|
|
url "https://github.com/kubernetes/kubernetes.git",
|
|
:tag => "v1.9.5",
|
|
:revision => "f01a2bf98249a4db383560443a59bed0c13575df"
|
|
head "https://github.com/kubernetes/kubernetes.git"
|
|
|
|
bottle do
|
|
sha256 "7f4f8f71944815d51d5c654dc38926d057b6d7a0a367957dc0a93ed6bb49b97a" => :high_sierra
|
|
sha256 "02a3bc48ccba6ee8faa3123ffd2c90502c845681ec47bf3a87ac40efe9e5b98e" => :sierra
|
|
sha256 "04cbefd0e939293c4478288f5e555fbb591e91dfc36141e51ad0d770a4cc2a23" => :el_capitan
|
|
end
|
|
|
|
# kubernetes-cli will not support go1.10 until version 1.11.x
|
|
depends_on "go@1.9" => :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
|