2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 00:37:51 +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,26 +284,29 @@ 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 dir_already_exists and (
if overwrite or click.confirm( overwrite
f"A directory for the application '{repo_name}' already exists." 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)
to_clone = True
shutil.rmtree(cloned_path) if to_clone:
elif click.confirm("Do you want to reinstall the existing application?", abort=True): app.get()
pass
fetch_txt = f"Getting {repo_name}" if (
click.secho(fetch_txt, fg="yellow") to_clone
logger.log(fetch_txt) or overwrite
or click.confirm("Do you want to reinstall the existing application?")
app.get() ):
app.install(verbose=verbose, skip_assets=skip_assets) app.install(verbose=verbose, skip_assets=skip_assets)
def new_app(app, bench_path="."): def new_app(app, bench_path="."):