refactor(scripts): organize script entry points
This commit is contained in:
1 parent
793eee5b61
commit
11c2b6dfcb
41 files changed
+102
-101
No files matched your search
@@ -0,0 +1,24 @@
|
||||
[CmdletBinding()]
|
||||
param([switch]$Summary)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
||||
. (Join-Path $root 'scripts/lib/manifest.ps1')
|
||||
. (Join-Path $root 'scripts/lib/install-targets.ps1')
|
||||
|
||||
$work = Join-Path ([System.IO.Path]::GetTempPath()) ("ai-config-install-guard-test-" + [Guid]::NewGuid())
|
||||
try {
|
||||
$installed = Join-Path $work 'installed'
|
||||
$missing = Join-Path $work 'missing'
|
||||
New-Item $installed -ItemType Directory -Force | Out-Null
|
||||
New-Item (Get-ManagedManifestPath $installed) -ItemType File -Force | Out-Null
|
||||
|
||||
if (-not (Test-AnyManifestPresent @($installed, $missing))) { throw 'Expected an installed destination to be detected.' }
|
||||
if (Test-AnyManifestPresent @($missing)) { throw 'A destination without a manifest must not count as installed.' }
|
||||
if (Test-AllManifestsPresent @($installed, $missing)) { throw 'Update guard must fail when any selected destination is not installed.' }
|
||||
if (-not (Test-AllManifestsPresent @($installed))) { throw 'Update guard must pass when every selected destination is installed.' }
|
||||
|
||||
if ($Summary) { Write-Output 'Tests: PASS | install guards' } else { Write-Output 'PASS install guards: already-installed and not-installed detection' }
|
||||
} finally {
|
||||
Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
exit 0
|
||||
Reference in new issue
Block a user