|
|
@@ -160,12 +160,10 @@ function Test-Dependencies {
|
|
|
|
|
|
# Check for MySQL/MariaDB client in PATH and common installation locations
|
|
|
$mysqlFound = $false
|
|
|
- $script:MYSQL_CLIENT = ""
|
|
|
|
|
|
# First check if already in PATH
|
|
|
foreach ($cmd in @("mysql", "mariadb")) {
|
|
|
if (Get-Command $cmd -ErrorAction SilentlyContinue) {
|
|
|
- $script:MYSQL_CLIENT = $cmd
|
|
|
$mysqlFound = $true
|
|
|
break
|
|
|
}
|
|
|
@@ -184,7 +182,6 @@ function Test-Dependencies {
|
|
|
foreach ($pattern in $searchPaths) {
|
|
|
$found = Get-ChildItem $pattern -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
|
if ($found) {
|
|
|
- $script:MYSQL_CLIENT = $found.FullName
|
|
|
$mysqlFound = $true
|
|
|
# Add to PATH for this session
|
|
|
$binDir = Split-Path $found.FullName
|
|
|
@@ -196,11 +193,11 @@ function Test-Dependencies {
|
|
|
}
|
|
|
|
|
|
if (-not $mysqlFound) {
|
|
|
- $missing += "MySQL/MariaDB client (winget install Oracle.MySQL or MariaDB.MariaDB)"
|
|
|
+ $missing += "MySQL/MariaDB client"
|
|
|
}
|
|
|
|
|
|
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
|
|
- $missing += "Git (winget install Git.Git)"
|
|
|
+ $missing += "Git"
|
|
|
}
|
|
|
|
|
|
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
|
|
|
@@ -753,6 +750,67 @@ function Setup-SeckelAPI {
|
|
|
Read-Host "`nPress Enter to continue"
|
|
|
}
|
|
|
|
|
|
+function Clean-Sources {
|
|
|
+ Write-Host "`n=== Clean Sources ==="-ForegroundColor Cyan
|
|
|
+ Write-Host "This will delete all sources directories including hidden files." -ForegroundColor Yellow
|
|
|
+ Write-Host " - backend\seckelapi\sources" -ForegroundColor Yellow
|
|
|
+ Write-Host " - frontend\desktop-client\sources" -ForegroundColor Yellow
|
|
|
+
|
|
|
+ $confirm = Read-Host "`nAre you sure you want to clean all sources? (y/n)"
|
|
|
+ if ($confirm -ne 'y') {
|
|
|
+ Write-Host "Cancelled." -ForegroundColor Gray
|
|
|
+ Read-Host "Press Enter to continue"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ $seckelapiSources = Join-Path $WORK_DIR "backend\seckelapi\sources"
|
|
|
+ $clientSources = Join-Path $WORK_DIR "frontend\desktop-client\sources"
|
|
|
+
|
|
|
+ # Clean SeckelAPI sources
|
|
|
+ if (Test-Path $seckelapiSources) {
|
|
|
+ Write-Host "`nRemoving SeckelAPI sources contents..." -ForegroundColor Yellow
|
|
|
+ Get-ChildItem -Path $seckelapiSources -Force | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
|
|
|
+ Write-Host " SeckelAPI sources cleaned" -ForegroundColor Green
|
|
|
+ } else {
|
|
|
+ Write-Host " SeckelAPI sources folder not found" -ForegroundColor Gray
|
|
|
+ }
|
|
|
+
|
|
|
+ # Clean desktop client sources
|
|
|
+ if (Test-Path $clientSources) {
|
|
|
+ Write-Host "Removing desktop client sources contents..." -ForegroundColor Yellow
|
|
|
+ Get-ChildItem -Path $clientSources -Force | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
|
|
|
+ Write-Host " Desktop client sources cleaned" -ForegroundColor Green
|
|
|
+ } else {
|
|
|
+ Write-Host " Desktop client sources folder not found" -ForegroundColor Gray
|
|
|
+ }
|
|
|
+
|
|
|
+ Write-Host "`nAll sources cleaned!" -ForegroundColor Green
|
|
|
+
|
|
|
+ # Ask to re-clone
|
|
|
+ $reclone = Read-Host "`nDo you want to pull fresh sources now? (y/n)"
|
|
|
+ if ($reclone -eq 'y') {
|
|
|
+ Write-Host "`nCloning SeckelAPI..." -ForegroundColor Yellow
|
|
|
+ $parentDir = Split-Path $seckelapiSources -Parent
|
|
|
+ New-Item -ItemType Directory -Force -Path $parentDir | Out-Null
|
|
|
+ $success = Run-Command -Command "git" -Arguments @("clone", $config.SECKELAPI_REPO, $seckelapiSources) `
|
|
|
+ -SuccessMessage "SeckelAPI cloned successfully!" `
|
|
|
+ -ErrorMessage "Failed to clone SeckelAPI" `
|
|
|
+ -ShowOutput
|
|
|
+
|
|
|
+ Write-Host "`nCloning desktop client..." -ForegroundColor Yellow
|
|
|
+ $parentDir = Split-Path $clientSources -Parent
|
|
|
+ New-Item -ItemType Directory -Force -Path $parentDir | Out-Null
|
|
|
+ $success = Run-Command -Command "git" -Arguments @("clone", $config.CLIENT_REPO, $clientSources) `
|
|
|
+ -SuccessMessage "Desktop client cloned successfully!" `
|
|
|
+ -ErrorMessage "Failed to clone desktop client" `
|
|
|
+ -ShowOutput
|
|
|
+
|
|
|
+ Write-Host "`nAll sources pulled fresh!" -ForegroundColor Green
|
|
|
+ }
|
|
|
+
|
|
|
+ Read-Host "`nPress Enter to continue"
|
|
|
+}
|
|
|
+
|
|
|
function Build-DesktopClient {
|
|
|
$sourcesDir = Join-Path $WORK_DIR "frontend\desktop-client\sources"
|
|
|
|
|
|
@@ -808,6 +866,7 @@ while ($true) {
|
|
|
"Manage users & roles",
|
|
|
"Configure & setup SeckelAPI",
|
|
|
"Build desktop client",
|
|
|
+ "Clean sources",
|
|
|
"Quit"
|
|
|
)
|
|
|
|
|
|
@@ -817,6 +876,7 @@ while ($true) {
|
|
|
3 { Manage-Users }
|
|
|
4 { Setup-SeckelAPI }
|
|
|
5 { Build-DesktopClient }
|
|
|
- 6 { exit 0 }
|
|
|
+ 6 { Clean-Sources }
|
|
|
+ 7 { exit 0 }
|
|
|
}
|
|
|
}
|