Created
September 5, 2018 22:37
-
-
Save KyleJamesWalker/024c2d1b5067db8f1e4ee0b4a0b8c5d4 to your computer and use it in GitHub Desktop.
tasks - Invoke Fun
This file contains 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
"""Example Build File""" | |
from invoke import task | |
from tasks.zefr_template import namespace | |
def build(ctx): | |
"""Build the image""" | |
print("Building Overridden!") | |
@task() | |
def deep_clean(ctx): | |
"""Additional cleaning""" | |
print("Custom Deep Clean~") | |
# Replace template build | |
namespace.tasks['build'].body = build | |
# Set deep_clean to happen before clean | |
namespace.tasks['clean'].pre.append(deep_clean) | |
# Expose deep_clean as a top level item | |
namespace.add_task(deep_clean) |
This file contains 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
"""Task Templates""" | |
from invoke import Collection, task | |
@task | |
def clean(ctx): | |
"""Clean the repo""" | |
print("Running docker-compose down") | |
@task(pre=[clean]) | |
def build(ctx): | |
"""Build the image""" | |
print("Building!") | |
namespace = Collection( | |
build, | |
clean, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment