click 0.3.2 (new formula)

Closes #26177.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
Michael K. Werle 2018-04-04 17:16:12 -05:00 committed by FX Coudert
parent 1247553634
commit 6b3304559f

58
Formula/click.rb Normal file
View file

@ -0,0 +1,58 @@
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.3.2.tar.gz"
sha256 "eed648409bf78a05658a9d097e5099ca17bf19df70122e2067859ae94c5575d5"
depends_on "rust" => :build
def install
system "cargo", "install", "--root", prefix
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