diff --git a/update.ps1 b/update.ps1 new file mode 100644 index 0000000..6c354ba --- /dev/null +++ b/update.ps1 @@ -0,0 +1,35 @@ +# GoMag Vending - Update Script +# Ruleaza ca Administrator: .\update.ps1 + +$RepoPath = "C:\gomag-vending" +$TokenFile = Join-Path $RepoPath ".gittoken" + +# Citire token +if (-not (Test-Path $TokenFile)) { + Write-Host "EROARE: $TokenFile nu exista!" -ForegroundColor Red + exit 1 +} +$token = (Get-Content $TokenFile -Raw).Trim() + +# Git pull +Write-Host "==> Git pull..." -ForegroundColor Cyan +Set-Location $RepoPath +git -c credential.helper="" pull "https://gomag-vending:$token@gitea.romfast.ro/romfast/gomag-vending.git" +if ($LASTEXITCODE -ne 0) { + Write-Host "EROARE: git pull esuat!" -ForegroundColor Red + exit 1 +} + +# Pip install (daca s-au schimbat dependintele) +Write-Host "==> Verificare dependinte..." -ForegroundColor Cyan +& "$RepoPath\venv\Scripts\pip.exe" install -r "$RepoPath\api\requirements.txt" --quiet + +# Restart serviciu +Write-Host "==> Restart GoMagVending..." -ForegroundColor Cyan +nssm restart GoMagVending + +Start-Sleep -Seconds 3 +$status = nssm status GoMagVending 2>&1 +Write-Host "Serviciu: $status" -ForegroundColor Green +Write-Host "" +Write-Host "Update complet! Acces: http://localhost/gomag/" -ForegroundColor Green