Files
melissa-uploader/run-all.ps1
T

32 lines
1.1 KiB
PowerShell
Raw Normal View History

# Run uploads for ALL entities under the Entities\ folder
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$entitiesDir = Join-Path $scriptRoot "Entities"
if (-not (Test-Path $entitiesDir)) {
Write-Host "Nothing is set up yet - double-click setup-entity.bat first." -ForegroundColor Yellow
exit 0
}
$entities = @(Get-ChildItem -Path $entitiesDir -Directory |
Where-Object { $_.Name -ne "EXAMPLE" -and (Test-Path (Join-Path $_.FullName "entity.json")) })
if ($entities.Count -eq 0) {
Write-Host "No entities are set up yet - double-click setup-entity.bat to add one." -ForegroundColor Yellow
exit 0
}
Write-Host "Found $($entities.Count) entity/entities to process."
$anyFail = $false
foreach ($entity in $entities) {
& powershell.exe -ExecutionPolicy Bypass -File (Join-Path $scriptRoot "engine.ps1") -EntityDir $entity.FullName
if ($LASTEXITCODE -ne 0) { $anyFail = $true }
}
Write-Host ""
if (-not $anyFail) {
Write-Host "All entities complete." -ForegroundColor Green
} else {
Write-Host "One or more entities had failures - check output above." -ForegroundColor Yellow
}