Skip to content

Instantly share code, notes, and snippets.

@brutus
Created May 17, 2017
Embed
What would you like to do?
Collection of invoke tasks to test `dry` setting.
"""
Quick check for `dry` / `ignore_dry` args to ``run``.
An ``invoke undry dry`` should result in::
[undry] Hello World!
[undry] Hello other World!
echo '[isdry] Hello World!'
[isdry] Hello other World!
"""
from invoke import task, Collection
@task
def status_undry(ctx):
ctx.run("echo '[undry] Hello World!'")
ctx.run("echo '[undry] Hello other World!'", ignore_dry=True)
@task
def status_isdry(ctx):
ctx.run("echo '[isdry] Hello World!'")
ctx.run("echo '[isdry] Hello other World!'", ignore_dry=True)
ns_undry = Collection('undry')
ns_undry.add_task(status_undry, 'status', default=True)
ns_isdry = Collection('dry')
ns_isdry.add_task(status_isdry, 'status', default=True)
ns_isdry.configure({
'run': {
'dry': True,
},
})
ns = Collection()
ns.add_collection(ns_undry)
ns.add_collection(ns_isdry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment