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:
parent
79980c3c55
commit
68c0549c18
25
bench/app.py
25
bench/app.py
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user