fixed the create_project command so it allows the opiton of overwriting the old backup (if exists) or stopping the process
This commit is contained in:
parent
0eaadc3fcf
commit
a5fb86f5cc
1 changed files with 33 additions and 5 deletions
|
|
@ -9,6 +9,7 @@ from .utils import loggify, print_run, booleanize
|
|||
from .utils import generate_template_build_path
|
||||
from .utils import generate_template_files_path
|
||||
from .utils import handle_help
|
||||
from .utils import prompt_continue
|
||||
|
||||
import os
|
||||
|
||||
|
|
@ -267,6 +268,33 @@ def create_project():
|
|||
fabric_ops.run("rm %s" % manage_path)
|
||||
|
||||
if exists(full_project_path):
|
||||
|
||||
# we need to make sure that
|
||||
# a. we back up the current settings for the project
|
||||
# b. that we don't override the OLD project backup settings
|
||||
# c. and that we give ourselves the option to NOT backup
|
||||
#
|
||||
# so if the system sees that we already have a backup of the main
|
||||
# folder, ie. projectname.old, then it will give us the option to
|
||||
# either overwrite the old backup (Y), or to stop the proecess and do
|
||||
# whatever needs to be done to clear things up
|
||||
|
||||
project_path_old = "{project_path}/{project_name}.old".format(
|
||||
project_path=project_path,
|
||||
project_name=project_name)
|
||||
|
||||
if exists(project_path_old):
|
||||
prompt_continue(
|
||||
message="found an already existing old version of "
|
||||
"{project_path}, do you want to ignore backing up the version or exit? Y/n"
|
||||
"( Y to continue without backing up. N to exit )", default="n")
|
||||
|
||||
fabric_ops.run("rm -Rf {project_path}/{project_name}".format(
|
||||
project_name=project_name,
|
||||
project_path=project_path))
|
||||
|
||||
else:
|
||||
|
||||
# backup whatever is there
|
||||
fabric_ops.run("mv {project_path}/{project_name}"
|
||||
" {project_path}/{project_name}.old".format(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue