2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +00:00

refactor(get_app): Workflow for clones/install

This commit is contained in:
Gavin D'souza 2021-11-15 12:37:03 +05:30
parent 79980c3c55
commit 68c0549c18

View File

@ -284,25 +284,28 @@ def get_app(
cloned_path = os.path.join(bench_path, "apps", repo_name) cloned_path = os.path.join(bench_path, "apps", repo_name)
dir_already_exists = os.path.isdir(cloned_path) dir_already_exists = os.path.isdir(cloned_path)
to_clone = not dir_already_exists
if dir_already_exists:
# application directory already exists # application directory already exists
# prompt user to overwrite it # prompt user to overwrite it
if overwrite or click.confirm( if dir_already_exists and (
f"A directory for the application '{repo_name}' already exists." overwrite
or click.confirm(
f"A directory for the application '{repo_name}' already exists. "
"Do you want to continue and overwrite it?" "Do you want to continue and overwrite it?"
)
): ):
import shutil
shutil.rmtree(cloned_path) shutil.rmtree(cloned_path)
elif click.confirm("Do you want to reinstall the existing application?", abort=True): to_clone = True
pass
fetch_txt = f"Getting {repo_name}"
click.secho(fetch_txt, fg="yellow")
logger.log(fetch_txt)
if to_clone:
app.get() app.get()
if (
to_clone
or overwrite
or click.confirm("Do you want to reinstall the existing application?")
):
app.install(verbose=verbose, skip_assets=skip_assets) app.install(verbose=verbose, skip_assets=skip_assets)