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"
2020-12-03 03:31:27 +00:00
homepage "https://kubecm.cloud"
url "https://github.com/sunny0826/kubecm/archive/v0.11.0.tar.gz"
sha256 "5eb167b3f461c5f3823807b6011e56dc278aa4946bc267a65cdbe993f4fbf09a"
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-12-04 15:15:56 +00:00
sha256 "01281af8670dee70c59c7579c306b936f9799fb2bf5c136bd4595758a4b1a174" => :big_sur
sha256 "dd9db15f719423135955a90425ee7dbc94fd9e78804a59c7e5eabd9c52ee73e3" => :catalina
sha256 "f0727e9f3d3a970003e9465879f208c446bd05404eba834fb6806aa737022bb8" => :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