added edit project configuration files capability

This commit is contained in:
Ronny Abraham 2018-10-10 13:06:19 +03:00
parent 35cdb1fe13
commit 0fd0bbe725

View file

@ -257,3 +257,57 @@ def copy_directories(source_path, dest_path):
fpath = os.path.join(source_path, fname)
put(fpath, dest_path)
@task
def edit(param='help'):
"""
calls up mvim on the yaml project configuration files
"""
from maintenance import edit as maintenance_edit
from maintenance import _get_configuration_path
locations = {
'development': {
'path': _get_configuration_path("config", "development"),
'desc': 'development project configuration file',
},
'staging': {
'path': _get_configuration_path("config", "staging"),
'desc': 'staging project configuration file',
},
'production': {
'path': _get_configuration_path("config", "production"),
'desc': 'production project configuration file',
},
}
if param in locations.keys():
# it is unnecessary to give the host_string to edit
# because the host_string is determined when we call fab
# ie. "fab devel whatever" or "fab stage whatever"
# we want to edit all files on localhost. b/c we only call
# fab FROM localhost
remote_path = locations[param]['path']
maintenance_edit(remote_path=remote_path)
else:
# if param == 'help':
print """
"fab configuration.edit" automates opening up and editing project
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