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 "https://www.pyinvoke.org/"
|
|
url "https://github.com/pyinvoke/invoke/archive/1.2.0.tar.gz"
|
|
sha256 "266003d33a8b3a565268e33aa0f9767b9441cf1476a20258f929768ee5acd390"
|
|
head "https://github.com/pyinvoke/invoke.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "2da4633f99eff3a69f4b176fafc4d5dfc53ee755bd3f1e6b2e9bd9a81c668101" => :mojave
|
|
sha256 "7ac129155662392463926cd394bb1721bfa5aedba204ea00e68f2e3278a008bb" => :high_sierra
|
|
sha256 "b5f66b9b794c89e86c1b860ea840d4ffe663fdbe7badd3d65c252db3a5a16141" => :sierra
|
|
end
|
|
|
|
depends_on "python@2"
|
|
|
|
def install
|
|
virtualenv_install_with_resources
|
|
end
|
|
|
|
test do
|
|
(testpath/"tasks.py").write <<~EOS
|
|
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"
|
|
refute_predicate testpath/"foo", :exist?, "\"pyinvoke clean\" should have deleted \"foo\""
|
|
assert_predicate testpath/"baz", :exist?, "pyinvoke should have left \"baz\""
|
|
system bin/"invoke", "clean", "--extra=baz"
|
|
refute_predicate testpath/"foo", :exist?, "\"pyinvoke clean-extra\" should have still deleted \"foo\""
|
|
refute_predicate testpath/"baz", :exist?, "pyinvoke clean-extra should have deleted \"baz\""
|
|
end
|
|
end
|