Skip to content

Instantly share code, notes, and snippets.

@sophacles
Created August 20, 2014 17:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sophacles/c17ce33a14d582dfa268 to your computer and use it in GitHub Desktop.
Save sophacles/c17ce33a14d582dfa268 to your computer and use it in GitHub Desktop.
Functions for making entry points with invoke
import invoke
import invoke.cli
from invoke import run, ctask as task, Collection
import sys
def redo_args(coll, baseargs=[]):
import our_tasks
root = our_tasks.__path__[0]
print "root is:", root
args = sys.argv[1:]
# HACK until we are shure that everything we need is invoke >= 0.8
if invoke.__version_info__[1] < 8:
newargs = [] + baseargs
else:
newargs = ["invoke"] + baseargs
newargs.extend(["--collection={}".format(coll), "--root={}".format(root)])
newargs.extend(args)
print "newargs is:", newargs
return newargs
def build():
invoke.cli.dispatch(redo_args("build", ['-e']))
def dev():
invoke.cli.dispatch(redo_args("dev", ['-e', '-p']))
def prod():
invoke.cli.dispatch(redo_args("prod_all", ['-e', '-p']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment