45 lines
1.6 KiB
Ruby
45 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.13.0.tar.gz"
|
|
sha256 "4942aa901618f99afa70271d7b15fd018da0f174178fbca4048354c785e7736a"
|
|
head "https://github.com/pyinvoke/invoke.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "20200d261ced810ae859c7408879d6c3fb92480beb06fd999e38ad59e68fac87" => :sierra
|
|
sha256 "2ee953c615f8a7b3fb885e4541387e86e056a4c459943b3d1f34f29f8f915aee" => :el_capitan
|
|
sha256 "a58ca03819c67a1cf734f0afce0b5c4b161b25ac7a069b7e501ef9ba6facd42b" => :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
|