59 lines
1.9 KiB
Ruby
59 lines
1.9 KiB
Ruby
class KubernetesCli < Formula
|
|
desc "Kubernetes command-line interface"
|
|
homepage "http://kubernetes.io/"
|
|
url "https://github.com/kubernetes/kubernetes.git",
|
|
:tag => "v1.5.3",
|
|
:revision => "029c3a408176b55c30846f0faedf56aae5992e9b"
|
|
head "https://github.com/kubernetes/kubernetes.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
rebuild 1
|
|
sha256 "e455186d50515f4b0c33328b81f9635eb24cede69c6ed9fa1f250b412d07e0f5" => :sierra
|
|
sha256 "eab70ac4da5f9196ffb257a6cc0a2e86e99d07d070e69a5019e9ac2a2a4ccf71" => :el_capitan
|
|
sha256 "326a543dc6ea0a779e1b20f67499f7b0cc3aa71128f934db1a342df8b11218b1" => :yosemite
|
|
end
|
|
|
|
devel do
|
|
url "https://github.com/kubernetes/kubernetes.git",
|
|
:tag => "v1.6.0-alpha.2",
|
|
:revision => "7738f41b958bd8a8018333b9c3eb86c563e1ee1a"
|
|
version "1.6.0-alpha.2"
|
|
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
|
|
end
|
|
end
|