102 lines
4.6 KiB
Ruby
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/e2/d3/2ff474be2543a868df1415f7a722d1b28016ee521982268e00b575adf0b9/osc-sdk-1.8.0.tar.gz"
|
|
sha256 "a4184cf708f1b42017d40b441463c87dbdfba5a6b6660a032e7cdc250ac3bea5"
|
|
license "BSD-3-Clause"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_monterey: "abd99ecf236c41a2a4642badd47933ca99cf9a09447cdd076a0da8c555e19f60"
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "d4dc6a4d980327f2fa5d525e084b43709f68861d404d5c550539335fc269185b"
|
|
sha256 cellar: :any_skip_relocation, monterey: "66fd16ab14086f13d96d21c833a46f46f045018ba41407e3a0d769779b0e8959"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "38946c6d5b1844c8e51b6cead3a831f3096ff8a8c20f848f69aac22b71e70e52"
|
|
sha256 cellar: :any_skip_relocation, catalina: "9a5187a600ebbc0ce41f12cfe2c308d027396be013f1cef55caf0b2633db67e4"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "6792bee630735a7849cddc8239b7992bf5d1ee5d76af206a3de928836e34f3bc"
|
|
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/56/31/7bcaf657fafb3c6db8c787a865434290b726653c912085fbd371e9b92e1c/charset-normalizer-2.0.12.tar.gz"
|
|
sha256 "2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"
|
|
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/60/f3/26ff3767f099b73e0efa138a9998da67890793bfa475d8278f84a30fec77/requests-2.27.1.tar.gz"
|
|
sha256 "68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"
|
|
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/fe/71/1df93bd59163c8084d812d166c907639646e8aac72886d563851b966bf18/typing_extensions-4.2.0.tar.gz"
|
|
sha256 "f1c24655a0da0d1b67f07e17a5e6b2a105894e6824b92096378bb3668ef02376"
|
|
end
|
|
|
|
resource "urllib3" do
|
|
url "https://files.pythonhosted.org/packages/1b/a5/4eab74853625505725cefdf168f48661b2cd04e7843ab836f3f63abf81da/urllib3-1.26.9.tar.gz"
|
|
sha256 "aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"
|
|
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
|