mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
refactor(get_app): Workflow for clones/install
This commit is contained in:
parent
79980c3c55
commit
68c0549c18
35
bench/app.py
35
bench/app.py
@ -284,26 +284,29 @@ def get_app(
|
||||
|
||||
cloned_path = os.path.join(bench_path, "apps", repo_name)
|
||||
dir_already_exists = os.path.isdir(cloned_path)
|
||||
to_clone = not dir_already_exists
|
||||
|
||||
if dir_already_exists:
|
||||
# application directory already exists
|
||||
# prompt user to overwrite it
|
||||
if overwrite or click.confirm(
|
||||
f"A directory for the application '{repo_name}' already exists."
|
||||
# application directory already exists
|
||||
# prompt user to overwrite it
|
||||
if dir_already_exists and (
|
||||
overwrite
|
||||
or click.confirm(
|
||||
f"A directory for the application '{repo_name}' already exists. "
|
||||
"Do you want to continue and overwrite it?"
|
||||
):
|
||||
import shutil
|
||||
)
|
||||
):
|
||||
shutil.rmtree(cloned_path)
|
||||
to_clone = True
|
||||
|
||||
shutil.rmtree(cloned_path)
|
||||
elif click.confirm("Do you want to reinstall the existing application?", abort=True):
|
||||
pass
|
||||
if to_clone:
|
||||
app.get()
|
||||
|
||||
fetch_txt = f"Getting {repo_name}"
|
||||
click.secho(fetch_txt, fg="yellow")
|
||||
logger.log(fetch_txt)
|
||||
|
||||
app.get()
|
||||
app.install(verbose=verbose, skip_assets=skip_assets)
|
||||
if (
|
||||
to_clone
|
||||
or overwrite
|
||||
or click.confirm("Do you want to reinstall the existing application?")
|
||||
):
|
||||
app.install(verbose=verbose, skip_assets=skip_assets)
|
||||
|
||||
|
||||
def new_app(app, bench_path="."):
|
||||
|
Loading…
Reference in New Issue
Block a user