Compare commits
2 Commits
9343602764
...
73c4505780
| Author | SHA1 | Date |
|---|---|---|
|
|
73c4505780 | |
|
|
7abcccb333 |
3
TASKS.md
3
TASKS.md
|
|
@ -165,7 +165,7 @@ open until it is run on disposable machines with the required account setups.
|
|||
- [x] Remove superseded portable versions after successful activation while retaining the working version on failed updates and retrying interrupted cleanup (168 Linux Pester tests pass; 5 Windows-only skips).
|
||||
- [x] Give PDF Presenter associations a dedicated branded PDF document icon that remains stable across portable updates (169 Linux Pester tests pass; 5 Windows-only skips).
|
||||
- [x] Support explicit portable rename migrations that activate the successor before removing the verified old installation and handler registration, preserve local edits, and retry cleanup (189 Linux Pester tests pass; 5 Windows-only skips).
|
||||
- [ ] Replace the PDF Presenter declaration with the verified Deckstride release from `idle-org/Deckstride`, then select Deckstride once as the Windows `.pdf` default.
|
||||
- [x] Replace the PDF Presenter declaration with verified Deckstride 0.1.96 from `idle-org/Deckstride`; keep the one-time Windows `.pdf` default selection in the Windows acceptance task (192 Linux Pester tests pass; 5 Windows-only skips).
|
||||
|
||||
## PowerShell prerequisite reliability
|
||||
|
||||
|
|
@ -180,3 +180,4 @@ open until it is run on disposable machines with the required account setups.
|
|||
## Setup progress feedback
|
||||
|
||||
- [x] Show elapsed spinner feedback during the initial apply, keep redirected output plain, and replay child results and diagnostics after completion.
|
||||
- [x] Show elapsed feedback during `cc update-software`, preserve plain/JSON output, and accept `cc software-update` as an alias (192 Linux Pester tests pass; 5 Windows-only skips).
|
||||
|
|
|
|||
5
cc.ps1
5
cc.ps1
|
|
@ -1,6 +1,6 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Position = 0)][ValidateSet('doctor', 'plan', 'apply', 'sync', 'update-software', 'status', 'configs', 'capture', 'restore', 'schedule', 'unschedule', 'menu')][string]$Command = 'menu',
|
||||
[Parameter(Position = 0)][ValidateSet('doctor', 'plan', 'apply', 'sync', 'update-software', 'software-update', 'status', 'configs', 'capture', 'restore', 'schedule', 'unschedule', 'menu')][string]$Command = 'menu',
|
||||
[string]$Machine,
|
||||
[string]$Config,
|
||||
[string]$OutputPath,
|
||||
|
|
@ -40,6 +40,7 @@ Set-StrictMode -Version Latest
|
|||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
try {
|
||||
$Command = if ($Command -eq 'software-update') { 'update-software' } else { $Command }
|
||||
foreach ($module in @('State', 'Manifest', 'Repository', 'Packages', 'Adapters', 'Configs', 'Elevation', 'Scheduling', 'Core')) {
|
||||
$path = Join-Path $PSScriptRoot "src/$module.psm1"
|
||||
if (Test-Path -LiteralPath $path) { Import-Module $path -Force }
|
||||
|
|
@ -57,7 +58,7 @@ foreach ($module in @('State', 'Manifest', 'Repository', 'Packages', 'Adapters',
|
|||
Show-ConfigCentralMenu -Machine $Machine -DataRoot $DataRoot -RepositoryRoot $RepositoryRoot
|
||||
exit 0
|
||||
}
|
||||
$result = Invoke-ConfigCentral -Command $Command -Machine $Machine -Config $Config -ConfigsOnly:$ConfigsOnly -ForceConfigs:$ForceConfigs -OutputPath $OutputPath -Paths $paths -RepositoryRoot $RepositoryRoot -FromSnapshot:$FromSnapshot -Revision $Revision
|
||||
$result = Invoke-ConfigCentral -Command $Command -Machine $Machine -Config $Config -ConfigsOnly:$ConfigsOnly -ForceConfigs:$ForceConfigs -OutputPath $OutputPath -Paths $paths -RepositoryRoot $RepositoryRoot -FromSnapshot:$FromSnapshot -Revision $Revision -ShowProgress:(-not $Json)
|
||||
if ($Json) { $result | ConvertTo-Json -Depth 32 }
|
||||
else { Write-ConfigCentralResult $result }
|
||||
exit ([int]$result.exitCode)
|
||||
|
|
|
|||
|
|
@ -5,23 +5,30 @@
|
|||
"description": "Desktop productivity, communication, creative, media, and file synchronization applications.",
|
||||
"packages": [
|
||||
{
|
||||
"id": "pdf-presenter",
|
||||
"id": "deckstride",
|
||||
"provider": "portable",
|
||||
"source": "idle-org",
|
||||
"scope": "user",
|
||||
"update": "pinned",
|
||||
"version": "0.1.91",
|
||||
"url": "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter/releases/download/v0.1.91/pdf-presenter-portable-x86_64-pc-windows-gnu-v0.1.91.zip",
|
||||
"sha256": "a6030676245f3891b85f936ade7fb13d44baaea95e8e0e2cb2ef9b18937c5136",
|
||||
"executable": "pdf-presenter-portable-x86_64-pc-windows-gnu-v0.1.91/pdf-presenter.exe",
|
||||
"releaseApi": "https://proxy.dandaedre.com/gitea/api/v1/repos/idle-org/pdf-presenter/releases",
|
||||
"version": "0.1.96",
|
||||
"url": "https://proxy.dandaedre.com/gitea/idle-org/Deckstride/releases/download/v0.1.96/deckstride-portable-x86_64-pc-windows-gnu-v0.1.96.zip",
|
||||
"sha256": "5b5ed9f8fa268aa6a04a0b359fe40d99d047abdb489b154ac7e6f66376d8fc19",
|
||||
"executable": "deckstride-portable-x86_64-pc-windows-gnu-v0.1.96/deckstride.exe",
|
||||
"releaseApi": "https://proxy.dandaedre.com/gitea/api/v1/repos/idle-org/Deckstride/releases",
|
||||
"releaseChannel": "stable",
|
||||
"assetTemplate": "pdf-presenter-portable-x86_64-pc-windows-gnu-v{version}.zip",
|
||||
"executableTemplate": "pdf-presenter-portable-x86_64-pc-windows-gnu-v{version}/pdf-presenter.exe",
|
||||
"assetTemplate": "deckstride-portable-x86_64-pc-windows-gnu-v{version}.zip",
|
||||
"executableTemplate": "deckstride-portable-x86_64-pc-windows-gnu-v{version}/deckstride.exe",
|
||||
"checksumAsset": "SHA256SUMS",
|
||||
"displayName": "PDF Presenter",
|
||||
"displayName": "Deckstride",
|
||||
"fileAssociations": [".pdf"],
|
||||
"fileAssociationIcon": "assets/pdf-presenter-pdf.ico"
|
||||
"fileAssociationIcon": "assets/pdf-presenter-pdf.ico",
|
||||
"replaces": [
|
||||
{
|
||||
"source": "idle-org",
|
||||
"id": "pdf-presenter",
|
||||
"fileAssociations": [".pdf"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "pptx-reporter",
|
||||
|
|
|
|||
|
|
@ -138,15 +138,61 @@ function Invoke-ApplyPlan {
|
|||
finally { Exit-ApplyLock -Lock $lock -Paths $Paths }
|
||||
}
|
||||
|
||||
function Invoke-ConfigCentralChildProcess {
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$FilePath,
|
||||
[Parameter(Mandatory)][string[]]$Arguments,
|
||||
[string]$Status,
|
||||
[switch]$ShowProgress
|
||||
)
|
||||
$startInfo = [Diagnostics.ProcessStartInfo]::new()
|
||||
$startInfo.FileName = $FilePath
|
||||
$startInfo.UseShellExecute = $false
|
||||
$startInfo.RedirectStandardOutput = $true
|
||||
$startInfo.RedirectStandardError = $true
|
||||
foreach ($argument in $Arguments) { [void]$startInfo.ArgumentList.Add($argument) }
|
||||
$process = [Diagnostics.Process]::new()
|
||||
$process.StartInfo = $startInfo
|
||||
$stopwatch = [Diagnostics.Stopwatch]::StartNew()
|
||||
$animate = $ShowProgress -and -not [Console]::IsOutputRedirected
|
||||
$started = $false
|
||||
try {
|
||||
if ($ShowProgress -and $Status) { Write-Host $Status }
|
||||
if (-not $process.Start()) { throw "Could not start '$FilePath'." }
|
||||
$started = $true
|
||||
$outputTask = $process.StandardOutput.ReadToEndAsync()
|
||||
$errorTask = $process.StandardError.ReadToEndAsync()
|
||||
$frames = @('|', '/', '-', '\')
|
||||
$frame = 0
|
||||
while (-not $process.WaitForExit(125)) {
|
||||
if ($animate) {
|
||||
Write-Host -NoNewline ("`r{0} Updating software... {1}s" -f $frames[$frame % $frames.Count], [int]$stopwatch.Elapsed.TotalSeconds)
|
||||
$frame++
|
||||
}
|
||||
}
|
||||
if ($animate) { Write-Host -NoNewline ("`r{0}`r" -f (' ' * 56)) }
|
||||
[pscustomobject]@{
|
||||
exitCode = $process.ExitCode
|
||||
output = $outputTask.GetAwaiter().GetResult()
|
||||
error = $errorTask.GetAwaiter().GetResult()
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$stopwatch.Stop()
|
||||
if ($started -and -not $process.HasExited) { $process.WaitForExit() }
|
||||
$process.Dispose()
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-SnapshotCommand {
|
||||
param([string]$Snapshot, [string]$Machine, $Paths, [string]$Revision, [ValidateSet('apply', 'update-software')][string]$Command, [switch]$ConfigsOnly, [switch]$ForceConfigs)
|
||||
param([string]$Snapshot, [string]$Machine, $Paths, [string]$Revision, [ValidateSet('apply', 'update-software')][string]$Command, [switch]$ConfigsOnly, [switch]$ForceConfigs, [switch]$ShowProgress)
|
||||
$arguments = @('-NoLogo', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', (Join-Path $Snapshot 'cc.ps1'), $Command, '-Machine', $Machine, '-DataRoot', $Paths.Root, '-RepositoryRoot', $Snapshot, '-Revision', $Revision, '-FromSnapshot', '-Json')
|
||||
if ($ConfigsOnly) { $arguments += '-ConfigsOnly' }
|
||||
if ($ForceConfigs) { $arguments += '-ForceConfigs' }
|
||||
$text = & pwsh.exe @arguments
|
||||
$exitCode = $LASTEXITCODE
|
||||
try { $child = ($text -join [Environment]::NewLine) | ConvertFrom-Json -Depth 32 }
|
||||
catch { throw "Snapshot command returned invalid output (exit $exitCode): $($text -join [Environment]::NewLine)" }
|
||||
$status = "Refreshing Config Central and updating software for '$Machine'. This can take several minutes..."
|
||||
$process = Invoke-ConfigCentralChildProcess -FilePath 'pwsh.exe' -Arguments $arguments -Status $status -ShowProgress:$ShowProgress
|
||||
try { $child = $process.output | ConvertFrom-Json -Depth 32 }
|
||||
catch { throw "Snapshot command returned invalid output (exit $($process.exitCode)): $($process.output)$($process.error)" }
|
||||
return $child
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +200,7 @@ function Invoke-ConfigCentral {
|
|||
param(
|
||||
[string]$Command, [string]$Machine, [string]$Config, [switch]$ConfigsOnly,
|
||||
[switch]$ForceConfigs, [string]$OutputPath, $Paths, [string]$RepositoryRoot, [switch]$FromSnapshot,
|
||||
[string]$Revision
|
||||
[string]$Revision, [switch]$ShowProgress
|
||||
)
|
||||
if ($Command -eq 'doctor') { return Invoke-Doctor -Machine $Machine -RepositoryRoot $RepositoryRoot -Paths $Paths }
|
||||
if ($Command -eq 'configs') {
|
||||
|
|
@ -200,7 +246,7 @@ function Invoke-ConfigCentral {
|
|||
$settings = Read-JsonState -Path $Paths.Settings -Default ([ordered]@{})
|
||||
$remoteRevision = Resolve-RemoteRevision -RepositoryRoot $RepositoryRoot -Settings $settings
|
||||
$snapshot = New-RepositorySnapshot -RepositoryRoot $RepositoryRoot -Revision $remoteRevision -Paths $Paths
|
||||
$result = Invoke-SnapshotCommand -Snapshot $snapshot -Machine $Machine -Paths $Paths -Revision $remoteRevision -Command update-software
|
||||
$result = Invoke-SnapshotCommand -Snapshot $snapshot -Machine $Machine -Paths $Paths -Revision $remoteRevision -Command update-software -ShowProgress:$ShowProgress
|
||||
try { $selfUpdate = Update-RepositoryCheckout -RepositoryRoot $RepositoryRoot -Revision $remoteRevision }
|
||||
catch {
|
||||
$selfUpdate = [pscustomobject]@{ name = 'Config Central'; status = 'Failed'; message = $_.Exception.Message }
|
||||
|
|
|
|||
|
|
@ -23,4 +23,10 @@ Describe 'Software update CLI' {
|
|||
($output | Out-String) | Should -Match 'No repository branch is configured'
|
||||
($output | Out-String) | Should -Not -Match 'ValidateSet|Cannot validate argument'
|
||||
}
|
||||
It 'accepts software-update as an alias for the canonical command' {
|
||||
$output = & (Join-Path $PSHOME $(if ($IsWindows) { 'pwsh.exe' } else { 'pwsh' })) -NoProfile -File "$PSScriptRoot/../cc.ps1" software-update -Machine missing-test-machine -DataRoot "$TestDrive/software-alias-data" 2>&1
|
||||
$LASTEXITCODE | Should -Be 2
|
||||
($output | Out-String) | Should -Match 'No repository branch is configured'
|
||||
($output | Out-String) | Should -Not -Match 'ValidateSet|Cannot validate argument'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,30 @@ Describe 'Core workflow policy' {
|
|||
}
|
||||
}
|
||||
|
||||
Describe 'Child process progress feedback' {
|
||||
It 'captures child output and reports a plain start status' {
|
||||
InModuleScope Core {
|
||||
Mock Write-Host {}
|
||||
$powerShell = (Get-Process -Id $PID).Path
|
||||
$arguments = @('-NoProfile', '-Command', '[Console]::Out.Write("child-output"); [Console]::Error.Write("child-error"); exit 7')
|
||||
$result = Invoke-ConfigCentralChildProcess -FilePath $powerShell -Arguments $arguments -Status 'Updating test software...' -ShowProgress
|
||||
$result.exitCode | Should -Be 7
|
||||
$result.output | Should -Be 'child-output'
|
||||
$result.error | Should -Be 'child-error'
|
||||
Should -Invoke Write-Host -Times 1 -Exactly -ParameterFilter { $Object -eq 'Updating test software...' }
|
||||
}
|
||||
}
|
||||
It 'keeps machine-readable child runs free of progress output' {
|
||||
InModuleScope Core {
|
||||
Mock Write-Host {}
|
||||
$powerShell = (Get-Process -Id $PID).Path
|
||||
$result = Invoke-ConfigCentralChildProcess -FilePath $powerShell -Arguments @('-NoProfile', '-Command', '[Console]::Out.Write("{}")') -Status 'Hidden status'
|
||||
$result.output | Should -Be '{}'
|
||||
Should -Invoke Write-Host -Times 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Result status colors' {
|
||||
It 'colors statuses without coloring item names and messages' {
|
||||
InModuleScope Core {
|
||||
|
|
@ -167,13 +191,13 @@ Describe 'Software update command' {
|
|||
Mock Invoke-SnapshotCommand { [pscustomobject]@{ command = $Command; revision = $Revision; operations = @(); succeeded = $true; exitCode = 0 } }
|
||||
Mock Update-RepositoryCheckout { [pscustomobject]@{ name = 'Config Central'; status = 'Succeeded'; message = 'Updated' } }
|
||||
$paths = Get-ConfigCentralPaths -DataRoot "$Working/software-refresh"
|
||||
$result = Invoke-ConfigCentral -Command update-software -Machine test -Paths $paths -RepositoryRoot $Working
|
||||
$result = Invoke-ConfigCentral -Command update-software -Machine test -Paths $paths -RepositoryRoot $Working -ShowProgress
|
||||
$result.command | Should -Be 'update-software'
|
||||
$result.revision | Should -Be 'remote-revision'
|
||||
$result.operations[0].name | Should -Be 'Config Central'
|
||||
Should -Invoke Resolve-RemoteRevision -Times 1 -Exactly
|
||||
Should -Invoke New-RepositorySnapshot -Times 1 -Exactly -ParameterFilter { $Revision -eq 'remote-revision' }
|
||||
Should -Invoke Invoke-SnapshotCommand -Times 1 -Exactly -ParameterFilter { $Command -eq 'update-software' -and $Revision -eq 'remote-revision' }
|
||||
Should -Invoke Invoke-SnapshotCommand -Times 1 -Exactly -ParameterFilter { $Command -eq 'update-software' -and $Revision -eq 'remote-revision' -and $ShowProgress }
|
||||
Should -Invoke Update-RepositoryCheckout -Times 1 -Exactly -ParameterFilter { $Revision -eq 'remote-revision' }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,16 +20,17 @@ Describe 'Manifest resolution' {
|
|||
$result.packages.id | Should -Contain 'Waterfox.Waterfox'
|
||||
$result.packages.id | Should -Contain 'Meltytech.Shotcut'
|
||||
$result.packages.id | Should -Contain 'clsid2.mpc-hc'
|
||||
$presenter = $result.packages | Where-Object id -eq 'pdf-presenter'
|
||||
$presenter = $result.packages | Where-Object id -eq 'deckstride'
|
||||
$presenter.provider | Should -Be 'portable'
|
||||
$presenter.scope | Should -Be 'user'
|
||||
$presenter.update | Should -Be 'pinned'
|
||||
$presenter.displayName | Should -Be 'PDF Presenter'
|
||||
$presenter.displayName | Should -Be 'Deckstride'
|
||||
($presenter.fileAssociations -is [Array]) | Should -BeTrue
|
||||
$presenter.fileAssociations | Should -Be @('.pdf')
|
||||
$presenter.fileAssociationIcon | Should -Be 'assets/pdf-presenter-pdf.ico'
|
||||
$presenter.version | Should -Be '0.1.91'
|
||||
$presenter.version | Should -Be '0.1.96'
|
||||
$presenter.releaseChannel | Should -Be 'stable'
|
||||
$presenter.replaces[0].id | Should -Be 'pdf-presenter'
|
||||
$reporter = $result.packages | Where-Object id -eq 'pptx-reporter'
|
||||
$reporter.provider | Should -Be 'portable'
|
||||
$reporter.source | Should -Be 'beffroi'
|
||||
|
|
|
|||
Loading…
Reference in New Issue