homebrew-core/Formula/pyinvoke.rb
2020-01-16 08:43:32 -05:00

44 lines
1.6 KiB
Ruby

class Pyinvoke < Formula
include Language::Python::Virtualenv
desc "Pythonic task management & command execution"
homepage "https://www.pyinvoke.org/"
url "https://github.com/pyinvoke/invoke/archive/1.4.0.tar.gz"
sha256 "84b26e567cfab58ee85e18f7d095c3db3ec16c8f594d6bcc1270e36ff5e70ade"
head "https://github.com/pyinvoke/invoke.git"
bottle do
cellar :any_skip_relocation
sha256 "3e44096fcf661dd718d2e058401878ff9e71284d1ddab22f8f657c2f3eb904a7" => :catalina
sha256 "c29d4550852589bcdf329d281b34f8a2d2564bacf2707de20b59691e8ea12316" => :mojave
sha256 "97d58bd97b9866828542697bf970d45978bd4ebe79786201a3dcdb26b293a15f" => :high_sierra
end
depends_on "python@3.8"
def install
virtualenv_install_with_resources
end
test do
(testpath/"tasks.py").write <<~EOS
from invoke import run, task
@task
def clean(ctx, extra=''):
patterns = ['foo']
if extra:
patterns.append(extra)
for pattern in patterns:
run("rm -rf {}".format(pattern))
EOS
(testpath/"foo"/"bar").mkpath
(testpath/"baz").mkpath
system bin/"invoke", "clean"
refute_predicate testpath/"foo", :exist?, "\"pyinvoke clean\" should have deleted \"foo\""
assert_predicate testpath/"baz", :exist?, "pyinvoke should have left \"baz\""
system bin/"invoke", "clean", "--extra=baz"
refute_predicate testpath/"foo", :exist?, "\"pyinvoke clean-extra\" should have still deleted \"foo\""
refute_predicate testpath/"baz", :exist?, "pyinvoke clean-extra should have deleted \"baz\""
end
end