66 lines
2 KiB
Ruby
66 lines
2 KiB
Ruby
class Click < Formula
|
|
desc "The command-line interactive controller for Kubernetes"
|
|
homepage "https://github.com/databricks/click"
|
|
url "https://github.com/databricks/click/archive/v0.4.3.tar.gz"
|
|
sha256 "2f7f2cd2c53ef1fefe251ddf5f69fa5d6128c1776800a12461495f3e1af24c8b"
|
|
head "https://github.com/databricks/click.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "d4f0029a38738bd96c34e257ffa4d32a65452354b94c9feee6d12c35af8be770" => :catalina
|
|
sha256 "57598c45faa3379b4585686fbc6074f9755a01a733f4a6370ca5034756340b8f" => :mojave
|
|
sha256 "1da2b335adabf93bb8fd8bcfb772721ba6f89bb4d71ee9c8ef99e93afa0a6ca7" => :high_sierra
|
|
end
|
|
|
|
depends_on "rust" => :build
|
|
|
|
def install
|
|
system "cargo", "install", "--locked", "--root", prefix, "--path", "."
|
|
end
|
|
|
|
test do
|
|
mkdir testpath/"config"
|
|
# Default state configuration file to avoid warning on startup
|
|
(testpath/"config/click.config").write <<~EOS
|
|
---
|
|
namespace: ~
|
|
context: ~
|
|
editor: ~
|
|
terminal: ~
|
|
EOS
|
|
|
|
# Fake K8s configuration
|
|
(testpath/"config/config").write <<~EOS
|
|
apiVersion: v1
|
|
clusters:
|
|
- cluster:
|
|
insecure-skip-tls-verify: true
|
|
server: 'https://localhost:6443'
|
|
name: test-cluster
|
|
contexts:
|
|
- context:
|
|
cluster: test-cluster
|
|
user: test-user
|
|
name: test-context
|
|
current-context: test-context
|
|
kind: Config
|
|
preferences:
|
|
colors: true
|
|
users:
|
|
- name: test-cluster
|
|
user:
|
|
client-certificate-data: >-
|
|
invalid
|
|
client-key-data: >-
|
|
invalid
|
|
EOS
|
|
|
|
# This test cannot test actual K8s connectivity, but it is enough to prove click starts
|
|
(testpath/"click-test").write <<~EOS
|
|
spawn "#{bin}/click" --config_dir "#{testpath}/config"
|
|
expect "*\\[*none*\\]* *\\[*none*\\]* *\\[*none*\\]* >"
|
|
send "quit\\r"
|
|
EOS
|
|
system "expect", "-f", "click-test"
|
|
end
|
|
end
|