from fabric.api import env, task import os import sys import pathlib dir_parent = pathlib.Path(os.path.abspath(__file__)).parents[1] sys.path.append(str(dir_parent)) try: import customfabric.modules.initialize as initialize from customfabric.modules.utils import booleanize from customfabric.api import * except ImportError: raise # import modules.initialize as initialize # # from modules.utils import booleanize # # from api import * # # Note: this is a hack so I can add the various module files # into fab --list, but without getting the syntastic errors # because to do it I need to import them whether or not I'm using # them. And if I am not using them, I'll get a syntastic error branch = "development" def setup(): print("setup fabric configuration files") def all(): # # set debugging conditiong # fab {branch} {fab_command} --set debug=True if 'debug' in env: env.debug = booleanize(env.debug) else: env.debug = False # # # add the config attribute to env initialize.environment(branch) @task def stage(): """ Staging environment """ # # set the branch configuration we will # be working on global branch branch = "staging" print("in staging") all() @task def prod(): """ Production environment """ # # set the branch configuration we will # be working on global branch branch = "production" print("in production") all() @task def devel(): """ development environment """ global branch branch = "development" all() devel()