homebrew-core/Formula/osc-cli.rb

100 lines
4.6 KiB
Ruby

class OscCli < Formula
include Language::Python::Virtualenv
desc "Official Outscale CLI providing connectors to Outscale API"
homepage "https://github.com/outscale/osc-cli"
url "https://files.pythonhosted.org/packages/b0/60/cd6582d56188c841bd58ce004b67c0a64b8ad855175ea574f01b0158271d/osc-sdk-1.9.0.tar.gz"
sha256 "b6cc9b06500493ec445c073458c32b18709c6a5dd842410c3bd141efd81c7ff7"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, arm64_ventura: "51fb8b48198ed88fbfb632630991cb1cc6f55e1ecd172e6333c88f76d91e712f"
sha256 cellar: :any_skip_relocation, arm64_monterey: "8f4aa38a384a42a6f67e45e867f17b7798505b4c42accd99a06a04bf14189a78"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "d4f67aa3d1db55152bd09d455198cea002b6d0713898649ea43792aba90e2422"
sha256 cellar: :any_skip_relocation, ventura: "ad0c875d8dc42bec3468e9fe27ff8027b018c3c2b52917abb2bc6261e4e0a93f"
sha256 cellar: :any_skip_relocation, monterey: "aac7921084a5a48453e7107436d1a1a95b314b0cc6280c26c3bccdbd7507ce67"
sha256 cellar: :any_skip_relocation, big_sur: "26c675002c79f590c4321c4211acda199edb487f73b0218d7828e8a4637587d2"
sha256 cellar: :any_skip_relocation, catalina: "2877569347709416e213796e5193717e4464d195383c8ff9e12f732f1a419d7a"
sha256 cellar: :any_skip_relocation, x86_64_linux: "65d4b01674f06989bc42c32c9be9bc2c524348f616678505fe1924c7ea7f5603"
end
depends_on "python-typing-extensions"
depends_on "python@3.11"
depends_on "six"
resource "certifi" do
url "https://files.pythonhosted.org/packages/cb/a4/7de7cd59e429bd0ee6521ba58a75adaec136d32f91a761b28a11d8088d44/certifi-2022.9.24.tar.gz"
sha256 "0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"
end
resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/a1/34/44964211e5410b051e4b8d2869c470ae8a68ae274953b1c7de6d98bbcf94/charset-normalizer-2.1.1.tar.gz"
sha256 "5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"
end
resource "defusedxml" do
url "https://files.pythonhosted.org/packages/0f/d5/c66da9b79e5bdb124974bfe172b4daf3c984ebd9c2a06e2b8a4dc7331c72/defusedxml-0.7.1.tar.gz"
sha256 "1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"
end
resource "fire" do
url "https://files.pythonhosted.org/packages/11/07/a119a1aa04d37bc819940d95ed7e135a7dcca1c098123a3764a6dcace9e7/fire-0.4.0.tar.gz"
sha256 "c5e2b8763699d1142393a46d0e3e790c5eb2f0706082df8f647878842c216a62"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/8b/e1/43beb3d38dba6cb420cefa297822eac205a277ab43e5ba5d5c46faf96438/idna-3.4.tar.gz"
sha256 "814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/a5/61/a867851fd5ab77277495a8709ddda0861b28163c4613b011bc00228cc724/requests-2.28.1.tar.gz"
sha256 "7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"
end
resource "termcolor" do
url "https://files.pythonhosted.org/packages/62/1a/e78a930f70dd576f2a7250a98263ac973a80d6f1a395d89328844881a0c0/termcolor-2.1.0.tar.gz"
sha256 "b80df54667ce4f48c03fe35df194f052dc27a541ebbf2544e4d6b47b5d6949c4"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/b2/56/d87d6d3c4121c0bcec116919350ca05dc3afd2eeb7dc88d07e8083f8ea94/urllib3-1.26.12.tar.gz"
sha256 "3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"
end
resource "xmltodict" do
url "https://files.pythonhosted.org/packages/39/0d/40df5be1e684bbaecdb9d1e0e40d5d482465de6b00cbb92b84ee5d243c7f/xmltodict-0.13.0.tar.gz"
sha256 "341595a488e3e01a85a9d8911d8912fd922ede5fecc4dce437eb4b6c8d037e56"
end
def install
virtualenv_install_with_resources
end
test do
# we test the help wich is printed in stderr :(
str = shell_output("#{bin}/osc-cli -- --help 2>&1 >/dev/null")
assert_match "osc-cli SERVICE CALL <flags>", str
str = shell_output("#{bin}/osc-cli api ReadVms 2>&1 >/dev/null", 1)
assert_match "Missing Access Key for authentication", str
mkdir testpath/".osc"
(testpath/".osc/config.json").write <<~EOS
{
"default": {
"access_key": "F4K4T706S9XKGEXAMPLE",
"secret_key": "E4XJE8EJ98ZEJ18E4J9ZE84J19Q8E1J9S87ZEXAMPLE",
"host": "outscale.com",
"https": true,
"method": "POST",
"region_name": "eu-west-2"
}
}
EOS
str = shell_output("#{bin}/osc-cli api ReadVms 2>&1 >/dev/null", 1)
match = "raise OscApiException(http_response)"
assert_match match, str
end
end