mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 08:16:28 +00:00
fix: Delete folder if --no-backup is passed
This commit is contained in:
parent
69e14e512f
commit
f7f7459c51
18
bench/app.py
18
bench/app.py
@ -179,13 +179,19 @@ class App(AppMeta):
|
||||
)
|
||||
|
||||
@step(title="Archiving App {repo}", success="App {repo} Archived")
|
||||
def remove(self):
|
||||
def remove(self, no_backup: bool = False):
|
||||
active_app_path = os.path.join("apps", self.name)
|
||||
archived_path = os.path.join("archived", "apps")
|
||||
archived_name = get_available_folder_name(f"{self.repo}-{date.today()}", archived_path)
|
||||
archived_app_path = os.path.join(archived_path, archived_name)
|
||||
log(f"App moved from {active_app_path} to {archived_app_path}")
|
||||
shutil.move(active_app_path, archived_app_path)
|
||||
|
||||
if no_backup:
|
||||
shutil.rmtree(active_app_path)
|
||||
log(f"App deleted from {active_app_path}")
|
||||
else:
|
||||
archived_path = os.path.join("archived", "apps")
|
||||
archived_name = get_available_folder_name(f"{self.repo}-{date.today()}", archived_path)
|
||||
archived_app_path = os.path.join(archived_path, archived_name)
|
||||
|
||||
shutil.move(active_app_path, archived_app_path)
|
||||
log(f"App moved from {active_app_path} to {archived_app_path}")
|
||||
|
||||
@step(title="Installing App {repo}", success="App {repo} Installed")
|
||||
def install(
|
||||
|
@ -312,8 +312,7 @@ class BenchApps(MutableSequence):
|
||||
|
||||
def remove(self, app: "App", no_backup: bool = False):
|
||||
app.uninstall()
|
||||
if not no_backup:
|
||||
app.remove()
|
||||
app.remove(no_backup=no_backup)
|
||||
super().remove(app.repo)
|
||||
|
||||
def append(self, app: "App"):
|
||||
|
Loading…
Reference in New Issue
Block a user