Adaugă opțiunea Git Pull & Restart în menu.ps1
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user