homebrew-core/Formula/pyinvoke.rb
2017-06-08 00:20:07 -07:00

44 lines
1.6 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.18.1.tar.gz"
sha256 "c3f19091e28a80a408b216c79785164112c18a2b344d9f053001260a0c619884"
head "https://github.com/pyinvoke/invoke.git"
bottle do
cellar :any_skip_relocation
sha256 "06f7ea186f65f281c78c577b60669543db2a63f3c50ec998397daba9f5f0041c" => :sierra
sha256 "250e68a6998766b78fd37061f5fb6501429a3fb7f02ee18d5ab4d9ecdecd89e4" => :el_capitan
sha256 "dc6c25d511f7bbc446a2374d797458d5c2a7360e072547e303c535716e82396b" => :yosemite
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