Created
May 17, 2017 18:25
-
-
Save brutus/678a1fc34a0869ba2459ec3a42d70a86 to your computer and use it in GitHub Desktop.
Collection of invoke tasks to test `dry` setting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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