From e953c52092202fa33bd5e5a120056a90cb93546d Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Sun, 11 Jul 2021 20:13:37 -0500 Subject: [PATCH] Updated scripts and registered tasks. reset_db.py now has the updated path. Added reset database to tasks. watch_all.py has improved output. --- MultiShop/.vscode/tasks.json | 9 +++++++++ MultiShop/scripts/reset_db.py | 2 +- MultiShop/scripts/watch_all.py | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/MultiShop/.vscode/tasks.json b/MultiShop/.vscode/tasks.json index 93cb400..40c5adf 100644 --- a/MultiShop/.vscode/tasks.json +++ b/MultiShop/.vscode/tasks.json @@ -45,6 +45,15 @@ "run" ], "problemMatcher": ["$msCompile"] + }, + { + "label": "reset database", + "command": "py", + "type": "process", + "args": [ + "${workspaceFolder}/scripts/reset_db.py" + ], + "problemMatcher": ["$msCompile"] } ] } \ No newline at end of file diff --git a/MultiShop/scripts/reset_db.py b/MultiShop/scripts/reset_db.py index b2b925d..24177e0 100644 --- a/MultiShop/scripts/reset_db.py +++ b/MultiShop/scripts/reset_db.py @@ -2,7 +2,7 @@ import os import shutil -SERVER_DIR = "src/MultiShop/Server" +SERVER_DIR = "server" DATA_DIR = "Data" DB_MIGRATE_CMD = "dotnet ef migrations add InitialCreate -o {0}" DB_UPDATE_CMD = "dotnet ef database update" diff --git a/MultiShop/scripts/watch_all.py b/MultiShop/scripts/watch_all.py index 9449ac4..31aaaca 100644 --- a/MultiShop/scripts/watch_all.py +++ b/MultiShop/scripts/watch_all.py @@ -10,12 +10,12 @@ async def exec(cmd, path, silent=False): os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir(os.pardir) os.chdir(path) - print("Executing \"{0}\" in \"{1}\".".format(cmd, path)) proc = None if (not silent): + print("Executing \"{0}\" in \"{1}\".".format(cmd, path)) proc = await asyncio.create_subprocess_shell(cmd) else: - print("Executing in silent mode.") + print("Executing \"{0}\" in \"{1}\" silently.".format(cmd, path)) proc = await asyncio.create_subprocess_shell(cmd, stdout=devnull) await proc.wait()