master
guoxudong 2020-11-19 13:40:22 +08:00 committed by chenrui
parent 065795f533
commit d09fb6df02
1 changed files with 11 additions and 18 deletions

View File

@ -1,34 +1,27 @@
class Kubecm < Formula
desc "Merge multiple kubeconfig"
homepage "https://github.com/sunny0826/kubecm"
version "0.10.2"
desc "KubeConfig Manager"
homepage "https://guoxudong.io/post/kubecm/"
url "https://github.com/sunny0826/kubecm/archive/v0.10.2.tar.gz"
sha256 "1c5527a783c15f3389d0b8505a028704fd7238492d6ae511831cdaab32626c2f"
license "Apache-2.0"
bottle :unneeded
if OS.mac?
url "https://github.com/sunny0826/kubecm/releases/download/v0.10.2/kubecm_0.10.2_Darwin_x86_64.tar.gz"
sha256 "01d67b3b6fdf349e30e75a43e40153e2b2e92f68c1301ad0483eba465a7ac582"
end
if OS.linux? && Hardware::CPU.intel?
url "https://github.com/sunny0826/kubecm/releases/download/v0.10.2/kubecm_0.10.2_Linux_x86_64.tar.gz"
sha256 "4a0cf5b5cb47cdac57ae22528b3850a90cf8d9909b5560c243bd3a414be1438e"
end
depends_on "git"
depends_on "go" => :build
def install
bin.install "kubecm"
system "go", "build",
"-ldflags", "-X github.com/sunny0826/kubecm/cmd.kubecmVersion=#{version}",
"-o", bin/"kubecm"
# Install bash completion
output = Utils.safe_popen_read("#{bin}/kubecm", "completion", "bash")
(bash_completion/"kubecm").write output
# Install zsh completion
output = Utils.safe_popen_read("#{bin}/kubecm", "completion", "zsh")
(zsh_completion/"_kubecm").write output
end
test do
system "#{bin}/kubecm version"
assert_match "KubeConfig Manager:", shell_output("#{bin}/kubecm -h 2>&1")
end
end