From 4e58e663e98e17a6f6a97256b80b97491c3ab989 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Thu, 6 Nov 2025 21:38:35 +0200 Subject: [PATCH] =?UTF-8?q?Adaug=C4=83=20op=C8=9Biunea=20Git=20Pull=20&=20?= =?UTF-8?q?Restart=20=C3=AEn=20menu.ps1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nouă funcționalitate pentru actualizare automată: - Opțiunea [G] în meniul principal - Funcția Invoke-GitPullRestart care rulează git pull - Restart automat al serviciului dacă este instalat - Validare exit code și gestionare erori 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- deployment/windows/scripts/menu.ps1 | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/deployment/windows/scripts/menu.ps1 b/deployment/windows/scripts/menu.ps1 index 4df9501..b0bbaf9 100644 --- a/deployment/windows/scripts/menu.ps1 +++ b/deployment/windows/scripts/menu.ps1 @@ -58,6 +58,9 @@ function Show-MainMenu { Write-Host " [R] Run Scraper (Manual)" -ForegroundColor Cyan Write-Host " [T] Run Telegram Bot (Manual)" -ForegroundColor Cyan Write-Host "" + Write-Host " Maintenance:" -ForegroundColor DarkCyan + Write-Host " [G] Git Pull & Restart Service" -ForegroundColor Cyan + Write-Host "" Write-Host " [A] Open Deployment README" -ForegroundColor Gray Write-Host " [B] Open Quick Start Guide" -ForegroundColor Gray Write-Host " [C] Open Project in Explorer" -ForegroundColor Gray @@ -270,6 +273,49 @@ function Invoke-UpdateBrowsers { Read-Host "`nApasa Enter pentru a reveni la meniu" } +function Invoke-GitPullRestart { + Clear-Host + Write-Host "" + Write-Host ("=" * 80) -ForegroundColor Cyan + Write-Host "GIT PULL & RESTART SERVICE" -ForegroundColor Yellow + Write-Host ("=" * 80) -ForegroundColor Cyan + Write-Host "" + + # Git pull + Write-Host "[INFO] Actualizare proiect din Git..." -ForegroundColor Cyan + Write-Host "" + + Push-Location $ProjectDir + try { + git pull + $gitExitCode = $LASTEXITCODE + Write-Host "" + + if ($gitExitCode -eq 0) { + Write-Host "[SUCCES] Proiect actualizat!" -ForegroundColor Green + Write-Host "" + + # Restart service if installed + $service = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue + if ($service) { + Write-Host "[INFO] Restart serviciu..." -ForegroundColor Cyan + & "$ScriptDir\restart_service.ps1" + } else { + Write-Host "[INFO] Serviciul nu este instalat, restart nu este necesar" -ForegroundColor Yellow + } + } else { + Write-Host "[EROARE] Git pull a esuat cu codul $gitExitCode" -ForegroundColor Red + } + } catch { + Write-Host "[EROARE] Eroare la git pull: $_" -ForegroundColor Red + } finally { + Pop-Location + } + + Write-Host "" + Read-Host "Apasa Enter pentru a reveni la meniu" +} + # Main loop do { Show-MainMenu @@ -301,6 +347,8 @@ do { "t" { Invoke-RunTelegramBotManual } "U" { Invoke-UpdateBrowsers } "u" { Invoke-UpdateBrowsers } + "G" { Invoke-GitPullRestart } + "g" { Invoke-GitPullRestart } "0" { Write-Host "" Write-Host "Goodbye!" -ForegroundColor Green