homebrew-core/Formula/kubecm.rb

28 lines
854 B
Ruby
Raw Normal View History

2020-11-19 01:43:44 +00:00
class Kubecm < Formula
2020-11-19 05:40:22 +00:00
desc "KubeConfig Manager"
homepage "https://guoxudong.io/post/kubecm/"
url "https://github.com/sunny0826/kubecm/archive/v0.10.2.tar.gz"
sha256 "1c5527a783c15f3389d0b8505a028704fd7238492d6ae511831cdaab32626c2f"
2020-11-19 01:48:41 +00:00
license "Apache-2.0"
2020-11-19 01:43:44 +00:00
2020-11-19 05:40:22 +00:00
depends_on "go" => :build
2020-11-19 01:43:44 +00:00
def install
2020-11-19 05:40:22 +00:00
system "go", "build",
"-ldflags", "-X github.com/sunny0826/kubecm/cmd.kubecmVersion=#{version}",
"-o", bin/"kubecm"
2020-11-19 01:43:44 +00:00
# Install bash completion
output = Utils.safe_popen_read("#{bin}/kubecm", "completion", "bash")
(bash_completion/"kubecm").write output
2020-11-19 05:40:22 +00:00
2020-11-19 01:43:44 +00:00
# Install zsh completion
output = Utils.safe_popen_read("#{bin}/kubecm", "completion", "zsh")
(zsh_completion/"_kubecm").write output
end
test do
2020-11-19 06:04:07 +00:00
assert_match "\nKubeConfig Manager\n", shell_output("#{bin}/kubecm -h 2>&1")
2020-11-19 01:43:44 +00:00
end
end