55 lines
1.7 KiB
Ruby
55 lines
1.7 KiB
Ruby
class Kubie < Formula
|
|
desc "Much more powerful alternative to kubectx and kubens"
|
|
homepage "https://blog.sbstp.ca/introducing-kubie/"
|
|
url "https://github.com/sbstp/kubie/archive/v0.13.1.tar.gz"
|
|
sha256 "5439932790ffcf303fcf0771a5247e730d3aec704b8a68d3335b350fb9c2a301"
|
|
license "Zlib"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, big_sur: "b0558ef61181f59a2b68be4d56d129da76d0fa20520ec9aa7ea07702b936c279"
|
|
sha256 cellar: :any_skip_relocation, catalina: "1124c99bcea51cdf00b83596a89c49beb375066ee95d05b16576947f1eec9106"
|
|
sha256 cellar: :any_skip_relocation, mojave: "00073d6410709d3f7c7de2e5c77fe58ed746cbb551c1aac8ff17a83e177d4956"
|
|
end
|
|
|
|
depends_on "rust" => :build
|
|
depends_on "kubernetes-cli" => :test
|
|
|
|
def install
|
|
system "cargo", "install", *std_cargo_args
|
|
bash_completion.install "./completion/kubie.bash"
|
|
end
|
|
|
|
test do
|
|
mkdir_p testpath/".kube"
|
|
(testpath/".kube/kubie-test.yaml").write <<~EOS
|
|
apiVersion: v1
|
|
clusters:
|
|
- cluster:
|
|
server: http://0.0.0.0/
|
|
name: kubie-test-cluster
|
|
contexts:
|
|
- context:
|
|
cluster: kubie-test-cluster
|
|
user: kubie-test-user
|
|
namespace: kubie-test-namespace
|
|
name: kubie-test
|
|
current-context: baz
|
|
kind: Config
|
|
preferences: {}
|
|
users:
|
|
- user:
|
|
name: kubie-test-user
|
|
EOS
|
|
|
|
assert_match "kubie #{version}", shell_output("#{bin}/kubie --version")
|
|
|
|
assert_match "The connection to the server 0.0.0.0 was refused - did you specify the right host or port?",
|
|
shell_output("#{bin}/kubie exec kubie-test kubie-test-namespace kubectl get pod 2>&1")
|
|
end
|
|
end
|