44 lines
1.6 KiB
Ruby
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.17.0.tar.gz"
|
|
sha256 "5c49aa1844524172c3716027b876598c43db5f3aa214f516553c7cbfd491ead2"
|
|
head "https://github.com/pyinvoke/invoke.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "f508555b04363213cb545ea123389aa5ebf806a28292f4b06f08f221f54d7754" => :sierra
|
|
sha256 "035b30c3e6c7e1080d1339372aa58b465b45ab5c14d1e5747d4f934e4b67a9e4" => :el_capitan
|
|
sha256 "3237389e62a205520f3626caaa186485d3a218b68db630bb703a80866cdf628f" => :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
|