-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathformula_template.txt
63 lines (50 loc) · 1.59 KB
/
formula_template.txt
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
56
57
58
59
60
61
62
63
class AzureCli < Formula
include Language::Python::Virtualenv
desc "Microsoft Azure CLI 2.0"
homepage "https://docs.microsoft.com/cli/azure/overview"
url "{{ upstream_url }}"
version "{{ cli_version }}"
sha256 "{{ upstream_sha }}"
license "MIT"
head "https://github.com/Azure/azure-cli.git"
livecheck do
url "https://github.com/Azure/azure-cli/releases/latest"
regex(%r{href=.*?/tag/azure-cli[._-]v?(\d+(?:\.\d+)+)["' >]}i)
end
{{ bottle_hash }}
depends_on "[email protected]"
depends_on "[email protected]"
uses_from_macos "libffi"
on_linux do
depends_on "pkg-config" => :build
end
{{ resources }}
def install
venv = virtualenv_create(libexec, "python3.10", system_site_packages: false)
venv.pip_install resources
# Get the CLI components we'll install
components = [
buildpath/"src/azure-cli",
buildpath/"src/azure-cli-telemetry",
buildpath/"src/azure-cli-core",
]
# Install CLI
components.each do |item|
cd item do
venv.pip_install item
end
end
(bin/"az").write <<~EOS
#!/usr/bin/env bash
AZ_INSTALLER=HOMEBREW #{libexec}/bin/python -Im azure.cli \"$@\"
EOS
bash_completion.install "az.completion" => "az"
end
test do
json_text = shell_output("#{bin}/az cloud show --name AzureCloud")
azure_cloud = JSON.parse(json_text)
assert_equal azure_cloud["name"], "AzureCloud"
assert_equal azure_cloud["endpoints"]["management"], "https://management.core.windows.net/"
assert_equal azure_cloud["endpoints"]["resourceManager"], "https://management.azure.com/"
end
end