pyinvoke 0.13.0 (new formula)

Closes #5279.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Matthew L Daniel 2016-09-26 23:44:52 -07:00 committed by Mike McQuaid
parent 1a29060809
commit a6719b1c5a

37
Formula/pyinvoke.rb Normal file
View file

@ -0,0 +1,37 @@
class Pyinvoke < Formula
include Language::Python::Virtualenv
desc "Pythonic task management & command execution"
homepage "http://pyinvoke.org/"
url "https://github.com/pyinvoke/invoke/archive/0.13.0.tar.gz"
sha256 "4942aa901618f99afa70271d7b15fd018da0f174178fbca4048354c785e7736a"
head "https://github.com/pyinvoke/invoke.git"
depends_on :python if MacOS.version <= :snow_leopard
def install
virtualenv_install_with_resources
end
test do
(testpath/"tasks.py").write <<-EOS.undent
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"
assert !File.exist?(testpath/"foo"), "\"pyinvoke clean\" should have deleted \"foo\""
assert File.exist?(testpath/"baz"), "pyinvoke should have left \"baz\""
system bin/"invoke", "clean", "--extra=baz"
assert !File.exist?(testpath/"foo"), "\"pyinvoke clean-extra\" should have still deleted \"foo\""
assert !File.exist?(testpath/"baz"), "pyinvoke clean-extra should have deleted \"baz\""
end
end