homebrew-core/Formula/fred.rb

65 lines
3.2 KiB
Ruby

class Fred < Formula
include Language::Python::Virtualenv
desc "Fully featured FRED Command-line Interface & Python API wrapper"
homepage "https://fred.stlouisfed.org/docs/api/fred/"
url "https://files.pythonhosted.org/packages/1e/7a/bb49f22f2ce33109ce5a5f8c7b85263cbc97bf9c9b44ba612c8380d3406f/fred-py-api-1.1.0.tar.gz"
sha256 "f1eddf12fac2f26f656e317a11f61ec0129ba353187b659c20d05a600dba78c8"
license "MIT"
bottle do
rebuild 2
sha256 cellar: :any_skip_relocation, arm64_ventura: "038ca87b76b039b96be59f8f9ae72585ac799d2f4b42a3e1b9f446b6eeb28cb8"
sha256 cellar: :any_skip_relocation, arm64_monterey: "39d0c4f2992db1875e63d03385089c01e2cf6c239488de716cebc20dd5f81e04"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "e6de56dd9cf992ef2ed40952365734342ba8610ade484205389554bc20a22e31"
sha256 cellar: :any_skip_relocation, ventura: "c96afd270d08daa6597e97adce15bc43b112388136fc072d87e3f493a95a272f"
sha256 cellar: :any_skip_relocation, monterey: "ec23bad1c855b198b2db782dbf2188cf317a4c326bd9f5969fa7a71f46e7442d"
sha256 cellar: :any_skip_relocation, big_sur: "574a7f99f6f1cb236ecc18f98b9131ddcfd64e2e16adbc3b7e8329f116b84eff"
sha256 cellar: :any_skip_relocation, x86_64_linux: "4e60c8acab0afe882a01c26ec1d48f4a079fb6f2f2bd3ebd5808b65b62d2fbf6"
end
depends_on "python@3.11"
resource "certifi" do
url "https://files.pythonhosted.org/packages/37/f7/2b1b0ec44fdc30a3d31dfebe52226be9ddc40cd6c0f34ffc8923ba423b69/certifi-2022.12.7.tar.gz"
sha256 "35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"
end
resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/96/d7/1675d9089a1f4677df5eb29c3f8b064aa1e70c1251a0a8a127803158942d/charset-normalizer-3.0.1.tar.gz"
sha256 "ebea339af930f8ca5d7a699b921106c6e29c617fe9606fa7baa043c1cdae326f"
end
resource "click" do
url "https://files.pythonhosted.org/packages/59/87/84326af34517fca8c58418d148f2403df25303e02736832403587318e9e8/click-8.1.3.tar.gz"
sha256 "7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"
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/9d/ee/391076f5937f0a8cdf5e53b701ffc91753e87b07d66bae4a09aa671897bf/requests-2.28.2.tar.gz"
sha256 "98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/c5/52/fe421fb7364aa738b3506a2d99e4f3a56e079c0a798e9f4fa5e14c60922f/urllib3-1.26.14.tar.gz"
sha256 "076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72"
end
def install
virtualenv_install_with_resources
end
test do
# assert output & ensure exit code is 2
# NOTE: this makes an API request to FRED with a purposely invalid API key
assert_match \
shell_output("#{bin}/fred --api-key sqwer1234asdfasdfqwer1234asdfsdf categories get-category -i 15", 2), \
"Bad Request. The value for variable api_key is not registered."
end
end