homebrew-core/Formula/osc-cli.rb

102 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/88/27/82b58ed2c5180b065cc4b21d7de93b3c16d5e821f847ba62f1e6ab6ba253/osc-sdk-1.7.1.tar.gz"
sha256 "598b88cf63820bf217e685009f5a661d47c68fa050604b3c19f395df73e2df40"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "e86ca58d754bd038b43c9067893c6df524af6f0ced1917e8af4f81e7d905f4fe"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "324efa898a3e3988208b61a485d34733bb8fbd23b34629bde369716c891ca289"
sha256 cellar: :any_skip_relocation, monterey: "0c239904726a00995c8d410599759beab263d911aaaaa5642cccb0d610a90df0"
sha256 cellar: :any_skip_relocation, big_sur: "dd61db55a5a211118a60c1791b6295c4c07f16bb3be0185d48b79e6dc04efbbc"
sha256 cellar: :any_skip_relocation, catalina: "a8a6edf3f7899135f5924f594d92dbff094da06e52a75c040816f32493fb0cbd"
sha256 cellar: :any_skip_relocation, x86_64_linux: "20e4f3d59a0d403559477daacd507ebbb4788133bd1f5ffde1d5eaf9d9978ed0"
end
depends_on "python@3.10"
depends_on "six"
resource "certifi" do
url "https://files.pythonhosted.org/packages/6c/ae/d26450834f0acc9e3d1f74508da6df1551ceab6c2ce0766a593362d6d57f/certifi-2021.10.8.tar.gz"
sha256 "78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"
end
resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/2f/39/5d8ff929409113e9ff402e405a7c7880ab1fa6f118a4ab72443976a01711/charset-normalizer-2.0.8.tar.gz"
sha256 "735e240d9a8506778cd7a453d97e817e536bb1fc29f4f6961ce297b9c7a917b0"
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/62/08/e3fc7c8161090f742f504f40b1bccbfc544d4a4e09eb774bf40aafce5436/idna-3.3.tar.gz"
sha256 "9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/e7/01/3569e0b535fb2e4a6c384bdbed00c55b9d78b5084e0fb7f4d0bf523d7670/requests-2.26.0.tar.gz"
sha256 "b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"
end
resource "termcolor" do
url "https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz"
sha256 "1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"
end
resource "typing-extensions" do
url "https://files.pythonhosted.org/packages/0d/4a/60ba3706797b878016f16edc5fbaf1e222109e38d0fa4d7d9312cb53f8dd/typing_extensions-4.0.1.tar.gz"
sha256 "4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/80/be/3ee43b6c5757cabea19e75b8f46eaf05a2f5144107d7db48c7cf3a864f73/urllib3-1.26.7.tar.gz"
sha256 "4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece"
end
resource "xmltodict" do
url "https://files.pythonhosted.org/packages/58/40/0d783e14112e064127063fbf5d1fe1351723e5dfe9d6daad346a305f6c49/xmltodict-0.12.0.tar.gz"
sha256 "50d8c638ed7ecb88d90561beedbf720c9b4e851a9fa6c47ebd64e99d166d8a21"
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 \e[4mSERVICE\e[0m \e[4mCALL\e[0m <flags>", str
str = shell_output("#{bin}/osc-cli api ReadVms 2>&1 >/dev/null", 1)
assert_match "No configuration file found in home folder", 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