UMTS at Teleco 1 mēnesi atpakaļ
vecāks
revīzija
6052b9d20b
2 mainītis faili ar 90 papildinājumiem un 6 dzēšanām
  1. 44 2
      beepzone-helper.ps1
  2. 46 4
      beepzone-helper.sh

+ 44 - 2
beepzone-helper.ps1

@@ -750,6 +750,46 @@ function Setup-SeckelAPI {
     Read-Host "`nPress Enter to continue"
 }
 
+function Update-FromGitMasters {
+    $seckelapiSources = Join-Path $WORK_DIR "backend\seckelapi\sources"
+    $clientSources = Join-Path $WORK_DIR "frontend\desktop-client\sources"
+
+    $confirm = Read-Host "`nThis will run 'git pull' in both backend and frontend source directories. Continue? (y/n)"
+    if ($confirm -ne 'y') { return }
+
+    Write-Host "`nUpdating sources from git masters..." -ForegroundColor Yellow
+
+    # Update SeckelAPI
+    if (Test-Path (Join-Path $seckelapiSources ".git")) {
+        Write-Host "Updating SeckelAPI..." -ForegroundColor Cyan
+        Push-Location $seckelapiSources
+        try {
+            git pull
+        } catch {
+            Write-Host "Failed to update SeckelAPI: $_" -ForegroundColor Red
+        }
+        Pop-Location
+    } else {
+        Write-Host "SeckelAPI sources not found or not a git repository. Skipping." -ForegroundColor DarkGray
+    }
+
+    # Update Desktop Client
+    if (Test-Path (Join-Path $clientSources ".git")) {
+        Write-Host "`nUpdating Desktop Client..." -ForegroundColor Cyan
+        Push-Location $clientSources
+        try {
+            git pull
+        } catch {
+            Write-Host "Failed to update Desktop Client: $_" -ForegroundColor Red
+        }
+        Pop-Location
+    } else {
+        Write-Host "Desktop Client sources not found or not a git repository. Skipping." -ForegroundColor DarkGray
+    }
+
+    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
@@ -866,6 +906,7 @@ while ($true) {
         "Manage users & roles",
         "Configure & setup SeckelAPI",
         "Build desktop client",
+        "Update from git masters",
         "Clean sources",
         "Quit"
     )
@@ -876,7 +917,8 @@ while ($true) {
         3 { Manage-Users }
         4 { Setup-SeckelAPI }
         5 { Build-DesktopClient }
-        6 { Clean-Sources }
-        7 { exit 0 }
+        6 { Update-FromGitMasters }
+        7 { Clean-Sources }
+        8 { exit 0 }
     }
 }

+ 46 - 4
beepzone-helper.sh

@@ -110,8 +110,9 @@ ask_main_menu() {
       3 "Manage users & roles" \
       4 "Configure & setup SeckelAPI" \
       5 "Build desktop client" \
-      6 "Clean sources" \
-      7 "Quit" 2>"$CHOICE_FILE"
+      6 "Update from git masters" \
+      7 "Clean sources" \
+      8 "Quit" 2>"$CHOICE_FILE"
 
     choice=$(<"$CHOICE_FILE")
     case $choice in
@@ -120,8 +121,9 @@ ask_main_menu() {
       3) manage_users_and_roles ;;
       4) setup_seckelapi ;;
       5) build_desktop_client ;;
-      6) clean_sources ;;
-      7) exit 0 ;;
+      6) update_from_git_masters ;;
+      7) clean_sources ;;
+      8) exit 0 ;;
     esac
   done
 }
@@ -690,6 +692,46 @@ setup_seckelapi() {
   fi
 }
 
+update_from_git_masters() {
+  local seckelapi_sources="$WORK_DIR/backend/seckelapi/sources"
+  local client_sources="$WORK_DIR/frontend/desktop-client/sources"
+
+  if $DIALOG --yesno "This will run 'git pull' in both backend and frontend source directories.\n\nContinue?" 10 60; then
+    clear
+    echo "Updating sources from git masters..."
+    echo "===================================="
+    echo ""
+
+    # Update SeckelAPI
+    if [[ -d "$seckelapi_sources/.git" ]]; then
+      echo "Updating SeckelAPI..."
+      if (cd "$seckelapi_sources" && git pull); then
+        echo "SeckelAPI updated successfully."
+      else
+        echo "Failed to update SeckelAPI."
+      fi
+    else
+      echo "SeckelAPI sources not found or not a git repository. Skipping."
+    fi
+    echo ""
+
+    # Update Desktop Client
+    if [[ -d "$client_sources/.git" ]]; then
+      echo "Updating Desktop Client..."
+      if (cd "$client_sources" && git pull); then
+        echo "Desktop Client updated successfully."
+      else
+        echo "Failed to update Desktop Client."
+      fi
+    else
+      echo "Desktop Client sources not found or not a git repository. Skipping."
+    fi
+
+    echo ""
+    read -p "Press Enter to continue..."
+  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