Kaynağa Gözat

slight goofy update

crt 1 ay önce
ebeveyn
işleme
a3ed430f25
2 değiştirilmiş dosya ile 119 ekleme ve 9 silme
  1. 66 6
      beepzone-helper.ps1
  2. 53 3
      beepzone-helper.sh

+ 66 - 6
beepzone-helper.ps1

@@ -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 }
     }
 }

+ 53 - 3
beepzone-helper.sh

@@ -104,13 +104,14 @@ ask_main_menu() {
   while true; do
     $DIALOG --clear \
       --title "BeepZone Setup" \
-      --menu "Choose an action" 16 76 6 \
+      --menu "Choose an action" 17 76 7 \
       1 "Configure & run MariaDB (podman)" \
       2 "Import DB schema & data" \
       3 "Manage users & roles" \
       4 "Configure & setup SeckelAPI" \
       5 "Build desktop client" \
-      6 "Quit" 2>"$CHOICE_FILE"
+      6 "Clean sources" \
+      7 "Quit" 2>"$CHOICE_FILE"
 
     choice=$(<"$CHOICE_FILE")
     case $choice in
@@ -119,7 +120,8 @@ ask_main_menu() {
       3) manage_users_and_roles ;;
       4) setup_seckelapi ;;
       5) build_desktop_client ;;
-      6) exit 0 ;;
+      6) clean_sources ;;
+      7) exit 0 ;;
     esac
   done
 }
@@ -688,6 +690,54 @@ setup_seckelapi() {
   fi
 }
 
+clean_sources() {
+  $DIALOG --yesno "This will delete all sources directories including hidden files:\n\n- backend/seckelapi/sources\n- frontend/desktop-client/sources\n\nAre you sure?" 12 70 || return
+  
+  local seckelapi_sources="$WORK_DIR/backend/seckelapi/sources"
+  local client_sources="$WORK_DIR/frontend/desktop-client/sources"
+  
+  # Clean SeckelAPI sources
+  if [[ -d "$seckelapi_sources" ]]; then
+    find "$seckelapi_sources" -mindepth 1 -delete 2>>"$LOG_FILE"
+    if [[ $? -eq 0 ]]; then
+      echo "SeckelAPI sources contents removed" >>"$LOG_FILE"
+    fi
+  fi
+  
+  # Clean desktop client sources
+  if [[ -d "$client_sources" ]]; then
+    find "$client_sources" -mindepth 1 -delete 2>>"$LOG_FILE"
+    if [[ $? -eq 0 ]]; then
+      echo "Desktop client sources contents removed" >>"$LOG_FILE"
+    fi
+  fi
+  
+  $DIALOG --msgbox "All sources cleaned!" 7 50
+  
+  # Ask to re-clone
+  if $DIALOG --yesno "Do you want to pull fresh sources now?" 7 50; then
+    # Clone SeckelAPI
+    mkdir -p "$(dirname "$seckelapi_sources")"
+    if clone_if_missing "$SECKELAPI_REPO" "$seckelapi_sources"; then
+      $DIALOG --msgbox "SeckelAPI sources cloned successfully!" 7 50
+    else
+      $DIALOG --msgbox "Failed to clone SeckelAPI sources. Check log." 7 50
+      return 1
+    fi
+    
+    # Clone desktop client
+    mkdir -p "$(dirname "$client_sources")"
+    if clone_if_missing "$CLIENT_REPO" "$client_sources"; then
+      $DIALOG --msgbox "Desktop client sources cloned successfully!" 7 50
+    else
+      $DIALOG --msgbox "Failed to clone desktop client sources. Check log." 7 50
+      return 1
+    fi
+    
+    $DIALOG --msgbox "All sources pulled fresh!" 7 50
+  fi
+}
+
 build_desktop_client() {
   local sources_dir="$WORK_DIR/frontend/desktop-client/sources"