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.15.0.tar.gz" sha256 "214c3ff687afc094290c8fe1b5e1c2541f9afd4224b48ea8413c8d07cf99a61d" head "https://github.com/pyinvoke/invoke.git" bottle do cellar :any_skip_relocation sha256 "73ec2d26e8bbec3186d6e86c2f035dc22bc132ad00c9671bbeac262a9744da3f" => :sierra sha256 "c46c68797c78a7489e16cba4d9b1dfb32c1d6a45d0b5b08b48828da8e470f587" => :el_capitan sha256 "0b4c7efbb43f3a89f7f9d4c30d539109963e76d9331f5c649bbf90391684450f" => :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