-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtanzu-cli.rb
55 lines (44 loc) · 1.8 KB
/
tanzu-cli.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright 2023 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
class TanzuCli < Formula
desc "The core Tanzu command-line tool"
homepage "https://github.com/vmware-tanzu/tanzu-cli"
version "1.5.3"
head "https://github.com/vmware-tanzu/tanzu-cli.git", branch: "main"
checksums = {
"darwin-amd64" => "f23dd2420615b23c900949aa02955e9666e2b538c4440efe6f1a5b3d4c82ab44",
"darwin-arm64" => "1c3b6bd150092e74aec6dd4738025b1e5d1943bf81c0801279187e68e76ae28e",
"linux-amd64" => "5b865ef1c9c93e8b2dd302354b69d737ddc3c3072e94585658fddc844adff8e5",
"linux-arm64" => "6044468a7bd96c936a713b78f4aad780fff7ac4c93e88822871124bb070f64d0",
}
$arch = "arm64"
on_intel do
$arch = "amd64"
end
$os = "darwin"
on_linux do
$os = "linux"
end
url "https://github.com/vmware-tanzu/tanzu-cli/releases/download/v#{version}/tanzu-cli-#{$os}-#{$arch}.tar.gz"
sha256 checksums["#{$os}-#{$arch}"]
def install
# Intall the tanzu CLI
bin.install "tanzu-cli-#{$os}_#{$arch}" => "tanzu"
# Setup shell completion
output = Utils.safe_popen_read(bin/"tanzu", "completion", "bash")
(bash_completion/"tanzu").write output
output = Utils.safe_popen_read(bin/"tanzu", "completion", "zsh")
(zsh_completion/"_tanzu").write output
output = Utils.safe_popen_read(bin/"tanzu", "completion", "fish")
(fish_completion/"tanzu.fish").write output
end
# This verifies the installation
test do
# DO NOT set the eula or ceip values here as they would be persisted
# for the user's release installation. Instead, just use commands that
# don't trigger the prompts.
assert_match "version: v#{version}", shell_output("#{bin}/tanzu version")
output = shell_output("#{bin}/tanzu plugin -h")
assert_match "Manage CLI plugins", output
end
end