110 lines
5.0 KiB
Ruby
110 lines
5.0 KiB
Ruby
class AnsibleLint < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Checks ansible playbooks for practices and behaviour"
|
|
homepage "https://github.com/ansible/ansible-lint/"
|
|
url "https://files.pythonhosted.org/packages/7a/c4/69057a31e1608a890be27d22c0cdcc1e0ba8f1a5e8f801c991f10f3345c5/ansible-lint-5.4.0.tar.gz"
|
|
sha256 "2160a60b4ab034c04006d701a1779340ffb0f6e28f030ff8de958e1062a88962"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "00ec5132f0f1de9d7e78be2902602eed0ad038ad926827488a282f4db643a56e"
|
|
sha256 cellar: :any, arm64_big_sur: "be9a95ec164348627a61df264574c6fb0009452bd31c7ffe647bbd688f4eef24"
|
|
sha256 cellar: :any, monterey: "19548fefbfc9f7b5a7417be78b4d3c82ad16ccd62a232afa72f40cd26bc27de5"
|
|
sha256 cellar: :any, big_sur: "9b7e13e77fe4ef4d67055d0eecea01ff785574cc9eebfba11a660d8dcd27cf00"
|
|
sha256 cellar: :any, catalina: "720b65859a936519f0209fbeb668d4764237b20327acfb71ebf337cceb09542d"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "84ef743fdc929967d83720344fc884dbe6c3ef1d35c2fd3bcac7bdb10dd37053"
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "ansible"
|
|
depends_on "libyaml"
|
|
depends_on "python@3.10"
|
|
|
|
resource "bracex" do
|
|
url "https://files.pythonhosted.org/packages/bd/ef/6273bba9e5bc615aab4997159eeaddfe03c825eeabe2942c39e91be5afec/bracex-2.2.1.tar.gz"
|
|
sha256 "1c8d1296e00ad9a91030ccb4c291f9e4dc7c054f12c707ba3c5ff3e9a81bcd21"
|
|
end
|
|
|
|
resource "colorama" do
|
|
url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
|
|
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
|
|
end
|
|
|
|
resource "commonmark" do
|
|
url "https://files.pythonhosted.org/packages/60/48/a60f593447e8f0894ebb7f6e6c1f25dafc5e89c5879fdc9360ae93ff83f0/commonmark-0.9.1.tar.gz"
|
|
sha256 "452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60"
|
|
end
|
|
|
|
resource "enrich" do
|
|
url "https://files.pythonhosted.org/packages/bb/77/cb9b3d6f2e2e5f8104e907ea4c4d575267238f52c51cf9f864b865a99710/enrich-1.2.7.tar.gz"
|
|
sha256 "0a2ab0d2931dff8947012602d1234d2a3ee002d9a355b5d70be6bf5466008893"
|
|
end
|
|
|
|
resource "packaging" do
|
|
url "https://files.pythonhosted.org/packages/df/9e/d1a7217f69310c1db8fdf8ab396229f55a699ce34a203691794c5d1cad0c/packaging-21.3.tar.gz"
|
|
sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"
|
|
end
|
|
|
|
resource "Pygments" do
|
|
url "https://files.pythonhosted.org/packages/94/9c/cb656d06950268155f46d4f6ce25d7ffc51a0da47eadf1b164bbf23b718b/Pygments-2.11.2.tar.gz"
|
|
sha256 "4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a"
|
|
end
|
|
|
|
resource "pyparsing" do
|
|
url "https://files.pythonhosted.org/packages/d6/60/9bed18f43275b34198eb9720d4c1238c68b3755620d20df0afd89424d32b/pyparsing-3.0.7.tar.gz"
|
|
sha256 "18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea"
|
|
end
|
|
|
|
resource "PyYAML" do
|
|
url "https://files.pythonhosted.org/packages/36/2b/61d51a2c4f25ef062ae3f74576b01638bebad5e045f747ff12643df63844/PyYAML-6.0.tar.gz"
|
|
sha256 "68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"
|
|
end
|
|
|
|
resource "rich" do
|
|
url "https://files.pythonhosted.org/packages/72/de/b3a53cf1dfdbdc124e8110a60d6c6da8e39d4610c82491fc862383960552/rich-11.2.0.tar.gz"
|
|
sha256 "1a6266a5738115017bb64a66c59c717e7aa047b3ae49a011ede4abdeffc6536e"
|
|
end
|
|
|
|
resource "ruamel.yaml" do
|
|
url "https://files.pythonhosted.org/packages/46/a9/6ed24832095b692a8cecc323230ce2ec3480015fbfa4b79941bd41b23a3c/ruamel.yaml-0.17.21.tar.gz"
|
|
sha256 "8b7ce697a2f212752a35c1ac414471dc16c424c9573be4926b56ff3f5d23b7af"
|
|
end
|
|
|
|
resource "ruamel.yaml.clib" do
|
|
url "https://files.pythonhosted.org/packages/8b/25/08e5ad2431a028d0723ca5540b3af6a32f58f25e83c6dda4d0fcef7288a3/ruamel.yaml.clib-0.2.6.tar.gz"
|
|
sha256 "4ff604ce439abb20794f05613c374759ce10e3595d1867764dd1ae675b85acbd"
|
|
end
|
|
|
|
resource "tenacity" do
|
|
url "https://files.pythonhosted.org/packages/2c/f5/04748914f5c78f7418b803226bd56cdddd70ac369b936b3e24f5158017f1/tenacity-8.0.1.tar.gz"
|
|
sha256 "43242a20e3e73291a28bcbcacfd6e000b02d3857a9a9fff56b297a27afdc932f"
|
|
end
|
|
|
|
resource "wcmatch" do
|
|
url "https://files.pythonhosted.org/packages/a7/73/7c739ae235b7e3ee36f2c0084a595b89c62aefeafa52df8d54d26846b32b/wcmatch-8.3.tar.gz"
|
|
sha256 "371072912398af61d1e4e78609e18801c6faecd3cb36c54c82556a60abc965db"
|
|
end
|
|
|
|
def install
|
|
virtualenv_install_with_resources
|
|
xy = Language::Python.major_minor_version Formula["python@3.10"].opt_bin/"python3"
|
|
site_packages = "lib/python#{xy}/site-packages"
|
|
ansible = Formula["ansible"].opt_libexec
|
|
(libexec/site_packages/"homebrew-ansible.pth").write ansible/site_packages
|
|
end
|
|
|
|
test do
|
|
ENV["ANSIBLE_REMOTE_TEMP"] = testpath/"tmp"
|
|
(testpath/"playbook.yml").write <<~EOS
|
|
---
|
|
- hosts: all
|
|
gather_facts: False
|
|
tasks:
|
|
- name: ping
|
|
ping:
|
|
EOS
|
|
system bin/"ansible-lint", testpath/"playbook.yml"
|
|
end
|
|
end
|