homebrew-core/Formula/kubecm.rb

37 lines
1.2 KiB
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.3.tar.gz"
sha256 "a17a5ef095014ff3d914156f43b59bd4147145e3e12144fb8084139873772a25"
2020-11-19 01:48:41 +00:00
license "Apache-2.0"
2020-11-19 01:43:44 +00:00
2020-11-20 05:33:17 +00:00
bottle do
cellar :any_skip_relocation
2020-11-24 09:15:56 +00:00
sha256 "7ddc7d190b279a4a2a1de4f5f5fdaa25160ad42479e3ebfe08f72a52218615c6" => :big_sur
sha256 "b294304b509746dcbf8643398358fabed896806f706976bee91c0d67c1f98bad" => :catalina
sha256 "a6cc76519b512e575eafbf861ff01ff05bd1a1cffa593f6a5d7e28c7d207752e" => :mojave
2020-11-20 05:33:17 +00:00
end
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}",
*std_go_args
2020-11-19 05:40:22 +00:00
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
# Should error out as switch context need kubeconfig
status_output = shell_output("#{bin}/kubecm switch 2>&1", 1)
assert_match "Error: open", status_output
2020-11-19 01:43:44 +00:00
end
end