diff --git a/packaging/choco/resubmit-choco.ps1 b/packaging/choco/resubmit-choco.ps1 new file mode 100644 index 0000000..b9038ee --- /dev/null +++ b/packaging/choco/resubmit-choco.ps1 @@ -0,0 +1,67 @@ +<# +.SYNOPSIS + Rebuilds and pushes a specific taskmon Chocolatey package version for moderator resubmission. + +.DESCRIPTION + Downloads the published SHA256 checksums from the GitHub Release for the specified version, + rebuilds the .nupkg via build-choco.ps1, then pushes it to the Chocolatey Community Repository. + + Use this when a package has been rejected and needs to be resubmitted with the same version number. + +.PARAMETER Version + The version number to resubmit (e.g. 1.7.7). + +.PARAMETER ApiKey + Chocolatey API key. If omitted the CHOCO_API_KEY environment variable is used. + +.EXAMPLE + ./resubmit-choco.ps1 -Version 1.7.7 + ./resubmit-choco.ps1 -Version 1.7.8 -ApiKey "your-api-key" +#> +[CmdletBinding()] +param( + [Parameter(Mandatory)][string]$Version, + [string]$ApiKey = $env:CHOCO_API_KEY +) + +$ErrorActionPreference = 'Stop' + +if (-not $ApiKey) { + throw "Provide -ApiKey or set the CHOCO_API_KEY environment variable." +} + +$baseUrl = "https://github.com/jchas2/taskmon/releases/download/v$Version" + +function Get-PublishedSha256([string]$fileName) { + $url = "$baseUrl/$fileName" + Write-Host " Fetching $url" + $raw = (Invoke-WebRequest -Uri $url -UseBasicParsing).Content.Trim() + # Format: " " - take the first token. + return ($raw -split '\s+')[0].ToLowerInvariant() +} + +Write-Host "Fetching published checksums for v$Version..." +$x64Sha256 = Get-PublishedSha256 "taskmon-$Version-windows-x64.zip.sha256" +$arm64Sha256 = Get-PublishedSha256 "taskmon-$Version-windows-arm64.zip.sha256" + +Write-Host " x64 : $x64Sha256" +Write-Host " arm64 : $arm64Sha256" + +# Build the package into packaging/choco/dist/ +$buildScript = Join-Path $PSScriptRoot 'build-choco.ps1' +& $buildScript -Version $Version -X64Sha256 $x64Sha256 -Arm64Sha256 $arm64Sha256 +if ($LASTEXITCODE -ne 0) { throw "build-choco.ps1 failed." } + +$nupkg = Get-ChildItem (Join-Path $PSScriptRoot "dist\taskmon.$Version.nupkg") -ErrorAction SilentlyContinue +if (-not $nupkg) { + $nupkg = Get-ChildItem (Join-Path $PSScriptRoot 'dist\*.nupkg') | + Where-Object { $_.Name -like "*$Version*" } | + Select-Object -First 1 +} +if (-not $nupkg) { throw "Could not find .nupkg for version $Version in dist\." } + +Write-Host "Pushing $($nupkg.Name) to Chocolatey Community Repository..." +choco push $nupkg.FullName --source https://push.chocolatey.org/ --api-key $ApiKey +if ($LASTEXITCODE -ne 0) { throw "choco push failed with exit code $LASTEXITCODE" } + +Write-Host "Done. $($nupkg.Name) submitted for moderator review." diff --git a/packaging/choco/tools/LICENSE.txt b/packaging/choco/tools/LICENSE.txt deleted file mode 100644 index 6334529..0000000 --- a/packaging/choco/tools/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2026 Jason Chase - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/packaging/choco/tools/VERIFICATION.txt b/packaging/choco/tools/VERIFICATION.txt deleted file mode 100644 index 75508bb..0000000 --- a/packaging/choco/tools/VERIFICATION.txt +++ /dev/null @@ -1,28 +0,0 @@ -VERIFICATION - -Verification is intended to assist the Chocolatey moderators and community in verifying -that this package's contents are trustworthy. - -This package is published by the software author (jchas2) and downloads the official -release binaries from the project's GitHub Releases page at install time: - - https://github.com/jchas2/taskmon/releases - -The installer (tools\chocolateyinstall.ps1) downloads the architecture-appropriate archive: - - x64: https://github.com/jchas2/taskmon/releases/download/v/taskmon--windows-x64.zip - ARM64: https://github.com/jchas2/taskmon/releases/download/v/taskmon--windows-arm64.zip - -The embedded SHA256 checksums in chocolateyinstall.ps1 match the .sha256 files published -alongside each archive on the GitHub Release. To verify manually: - - 1. Download the archive for your architecture from the release URL above. - 2. Run: Get-FileHash -Algorithm SHA256 .\taskmon--windows-.zip - 3. Compare the hash to the value in chocolateyinstall.ps1 and to the published - taskmon--windows-.zip.sha256 file on the release. - -The binaries are built from source by the project's GitHub Actions release workflow: - - https://github.com/jchas2/taskmon/blob/main/.github/workflows/release.yml - -LICENSE: see LICENSE.txt in this directory and https://github.com/jchas2/taskmon diff --git a/tests/Task.Monitor.Tests/Configuration/ThemeTests.cs b/tests/Task.Monitor.Tests/Configuration/ThemeTests.cs index aa72cf4..86e5b5c 100644 --- a/tests/Task.Monitor.Tests/Configuration/ThemeTests.cs +++ b/tests/Task.Monitor.Tests/Configuration/ThemeTests.cs @@ -104,7 +104,74 @@ public void Setters_Initialise_Successfully() AssertThemeColours(theme); } - + + [Fact] + public void Setters_ReadBack_All_Colour_Properties_Successfully() + { + // Arrange – use a distinct colour per property so a mis-mapped setter is caught. + ConfigSection section = new("Read-Back Theme"); + + Theme theme = new(section); + + // Act – write every colour property through its setter. + theme.Background = ColorTranslator.FromHtml("#010101"); + theme.BackgroundHighlight = ColorTranslator.FromHtml("#020202"); + theme.ColumnCommandNormalUserSpace = ColorTranslator.FromHtml("#030303"); + theme.ColumnCommandLowPriority = ColorTranslator.FromHtml("#040404"); + theme.ColumnCommandHighCpu = ColorTranslator.FromHtml("#050505"); + theme.ColumnCommandIoBound = ColorTranslator.FromHtml("#060606"); + theme.ColumnCommandScript = ColorTranslator.FromHtml("#070707"); + theme.ColumnUserCurrentNonRoot = ColorTranslator.FromHtml("#080808"); + theme.ColumnUserOtherNonRoot = ColorTranslator.FromHtml("#090909"); + theme.ColumnUserSystem = ColorTranslator.FromHtml("#0a0a0a"); + theme.ColumnUserRoot = ColorTranslator.FromHtml("#0b0b0b"); + theme.CommandBackground = ColorTranslator.FromHtml("#0c0c0c"); + theme.CommandForeground = ColorTranslator.FromHtml("#0d0d0d"); + theme.DeltaHighlightColour = ColorTranslator.FromHtml("#0e0e0e"); + theme.Error = ColorTranslator.FromHtml("#0f0f0f"); + theme.Foreground = ColorTranslator.FromHtml("#101010"); + theme.ForegroundHighlight = ColorTranslator.FromHtml("#111111"); + theme.HeaderBackground = ColorTranslator.FromHtml("#121212"); + theme.HeaderForeground = ColorTranslator.FromHtml("#131313"); + theme.MenubarBackground = ColorTranslator.FromHtml("#141414"); + theme.MenubarForeground = ColorTranslator.FromHtml("#151515"); + theme.RangeHighBackground = ColorTranslator.FromHtml("#161616"); + theme.RangeLowBackground = ColorTranslator.FromHtml("#171717"); + theme.RangeMidBackground = ColorTranslator.FromHtml("#181818"); + theme.RangeHighForeground = ColorTranslator.FromHtml("#191919"); + theme.RangeLowForeground = ColorTranslator.FromHtml("#1a1a1a"); + theme.RangeMidForeground = ColorTranslator.FromHtml("#1b1b1b"); + + // Assert – read every colour property back through its getter. + Assert.Equal(ColorTranslator.FromHtml("#010101"), theme.Background); + Assert.Equal(ColorTranslator.FromHtml("#020202"), theme.BackgroundHighlight); + Assert.Equal(ColorTranslator.FromHtml("#030303"), theme.ColumnCommandNormalUserSpace); + Assert.Equal(ColorTranslator.FromHtml("#040404"), theme.ColumnCommandLowPriority); + Assert.Equal(ColorTranslator.FromHtml("#050505"), theme.ColumnCommandHighCpu); + Assert.Equal(ColorTranslator.FromHtml("#060606"), theme.ColumnCommandIoBound); + Assert.Equal(ColorTranslator.FromHtml("#070707"), theme.ColumnCommandScript); + Assert.Equal(ColorTranslator.FromHtml("#080808"), theme.ColumnUserCurrentNonRoot); + Assert.Equal(ColorTranslator.FromHtml("#090909"), theme.ColumnUserOtherNonRoot); + Assert.Equal(ColorTranslator.FromHtml("#0a0a0a"), theme.ColumnUserSystem); + Assert.Equal(ColorTranslator.FromHtml("#0b0b0b"), theme.ColumnUserRoot); + Assert.Equal(ColorTranslator.FromHtml("#0c0c0c"), theme.CommandBackground); + Assert.Equal(ColorTranslator.FromHtml("#0d0d0d"), theme.CommandForeground); + Assert.Equal(ColorTranslator.FromHtml("#0e0e0e"), theme.DeltaHighlightColour); + Assert.Equal(ColorTranslator.FromHtml("#0f0f0f"), theme.Error); + Assert.Equal(ColorTranslator.FromHtml("#101010"), theme.Foreground); + Assert.Equal(ColorTranslator.FromHtml("#111111"), theme.ForegroundHighlight); + Assert.Equal(ColorTranslator.FromHtml("#121212"), theme.HeaderBackground); + Assert.Equal(ColorTranslator.FromHtml("#131313"), theme.HeaderForeground); + Assert.Equal(ColorTranslator.FromHtml("#141414"), theme.MenubarBackground); + Assert.Equal(ColorTranslator.FromHtml("#151515"), theme.MenubarForeground); + Assert.Equal(ColorTranslator.FromHtml("#161616"), theme.RangeHighBackground); + Assert.Equal(ColorTranslator.FromHtml("#171717"), theme.RangeLowBackground); + Assert.Equal(ColorTranslator.FromHtml("#181818"), theme.RangeMidBackground); + Assert.Equal(ColorTranslator.FromHtml("#191919"), theme.RangeHighForeground); + Assert.Equal(ColorTranslator.FromHtml("#1a1a1a"), theme.RangeLowForeground); + Assert.Equal(ColorTranslator.FromHtml("#1b1b1b"), theme.RangeMidForeground); + } + private void AssertThemeColours(Theme theme) { Assert.Equal(ColorTranslator.FromHtml("#0f1610"), theme.Background);