63 lines
2.3 KiB
Ruby
63 lines
2.3 KiB
Ruby
class KubernetesCli < Formula
|
|
desc "Kubernetes command-line interface"
|
|
homepage "https://kubernetes.io/"
|
|
url "https://github.com/kubernetes/kubernetes.git",
|
|
:tag => "v1.7.6",
|
|
:revision => "4bc5e7f9a6c25dc4c03d4d656f2cefd21540e28c"
|
|
head "https://github.com/kubernetes/kubernetes.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "a499344c006d875583820b40edb7919938e5fc1cb11571914257247d80d6a09d" => :high_sierra
|
|
sha256 "bc0cc306c4f81a7624a67440f78100be9bd12ecd79252757d77e14e6ed43a65f" => :sierra
|
|
sha256 "5a359f9fac9c6f450a22d1d458663f90078a66e710bd29d03dbe4955c08c2247" => :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")
|
|
# Note: The explicit header to enable auto-loading by compinit
|
|
# can be removed after Kubernetes 1.8.0 when kubernetes/kubernetes#50561
|
|
# becomes available upstream.
|
|
(zsh_completion/"_kubectl").write <<-EOS.undent
|
|
#compdef kubectl
|
|
#{output}
|
|
_complete kubectl
|
|
EOS
|
|
|
|
# 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
|