43 lines
1.5 KiB
Ruby
43 lines
1.5 KiB
Ruby
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.21.0.tar.gz"
|
|
sha256 "ca2fcc56e5abdb9e56c9c5222786356a825a2b552e0137dd06184c54ce9a1cde"
|
|
head "https://github.com/pyinvoke/invoke.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "d11aae306e1a7482f80ab57c8bb4f2a4c9f3e040e6fad835a2d171fb00ab7a14" => :sierra
|
|
sha256 "29ac1318559e47eb5d9b3e09237514bdb51d6e33ea43ea11e442e678de1c1a10" => :el_capitan
|
|
end
|
|
|
|
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
|