From 926a126fb8926118e23927b2113ab046dc4021ad Mon Sep 17 00:00:00 2001 From: Ronny Abraham Date: Sun, 2 Jun 2019 22:31:41 +0300 Subject: [PATCH] add edit for meta configuration files --- modules/deploy.py | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/modules/deploy.py b/modules/deploy.py index a4dbee9..9504760 100644 --- a/modules/deploy.py +++ b/modules/deploy.py @@ -737,3 +737,51 @@ def ssh(): logger.debug("ssh command: %s" % cmd_ssh) else: local(cmd_ssh) + + +@task +def edit(param='help', branch=None): + """ + calls up mvim on the configuration files for the branch + """ + + from .maintenance import edit as maintenance_edit + from .maintenance import _get_configuration_path + + configuration = env.config + + if not branch: + project_branch = configuration.project.branch + else: + project_branch = branch + + config_path = _get_configuration_path('config', project_branch) + + # locations = ['gunicorn', 'gunicorn_link', 'gunicorn_build', + # 'settings', 'local'] + locations = { + 'configuration': { + 'path': config_path, + 'desc': 'meta configuration file', + }, + } + + if param in locations.keys(): + remote_path = locations[param]['path'] + maintenance_edit(remote_path=remote_path) + else: + # if param == 'help': + + print(""" + "fab deploy.edit" automates editing branch configuration files + + to use this you must pass one of the editable locations in as a + parameter + + currently editable locations are: + """) + + for k_loc in locations.keys(): + print("\t{0: <20} - {1}".format(k_loc, locations[k_loc]['desc'])) + + return