Created
August 20, 2014 17:03
-
-
Save sophacles/c17ce33a14d582dfa268 to your computer and use it in GitHub Desktop.
Functions for making entry points with invoke
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
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