61 lines
1.8 KiB
Ruby
61 lines
1.8 KiB
Ruby
class KubernetesCli < Formula
|
|
desc "Kubernetes command-line interface"
|
|
homepage "https://kubernetes.io/"
|
|
url "https://github.com/kubernetes/kubernetes.git",
|
|
tag: "v1.19.0",
|
|
revision: "e19964183377d0ec2052d1f1fa930c4d7575bd50"
|
|
license "Apache-2.0"
|
|
head "https://github.com/kubernetes/kubernetes.git"
|
|
|
|
livecheck do
|
|
url :head
|
|
regex(/^v([\d.]+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "46b7d96c97256a2a4a55fcbb8c72085a76ac6eac1b61a9d030d07ed7537f2c5c" => :catalina
|
|
sha256 "214b259580cd5d9c0a4c97c5bc56931a3ae86a035ce0c67bc1c12671bcb4f175" => :mojave
|
|
sha256 "b5a5d643326f9301164e1167d9ad21d9657a55da697da761cf5feb42be629ca2" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
uses_from_macos "rsync" => :build
|
|
|
|
def install
|
|
# Don't dirty the git tree
|
|
rm_rf ".brew_home"
|
|
|
|
# Make binary
|
|
system "make", "WHAT=cmd/kubectl"
|
|
bin.install "_output/bin/kubectl"
|
|
|
|
# Install bash completion
|
|
output = Utils.safe_popen_read("#{bin}/kubectl", "completion", "bash")
|
|
(bash_completion/"kubectl").write output
|
|
|
|
# Install zsh completion
|
|
output = Utils.safe_popen_read("#{bin}/kubectl", "completion", "zsh")
|
|
(zsh_completion/"_kubectl").write output
|
|
|
|
# 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
|
|
|
|
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
|
|
if build.stable?
|
|
assert_match stable.instance_variable_get(:@resource)
|
|
.instance_variable_get(:@specs)[:revision],
|
|
version_output
|
|
end
|
|
end
|
|
end
|