homebrew-core/Formula/pyinvoke.rb
2017-04-19 02:21:10 -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.16.3.tar.gz"
sha256 "7230458748de9e8d34f76cf2e9d50b4265cade41d98464c5aefb2c436f9e94c2"
head "https://github.com/pyinvoke/invoke.git"
bottle do
cellar :any_skip_relocation
sha256 "d5e63fd3622c6f0b3a7b4f19107c6e708fd590a8f4a02c602cd6bc547095a641" => :sierra
sha256 "ffedb8ab8c77b86abcf60692096de92c6e01412cb0ba17dd2ca34f1efb4eea99" => :el_capitan
sha256 "6cbca8bb9dedc851384955969e008b35861089b55e191587205d759eb850e2b0" => :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