Skip to content

Commit 634c91c

Browse files
Fix prefix false-positive in skip check, cap download throttle at 8, isolate test cache artifacts
- Installed-font skip now matches 'Ubuntu Nerd Font*' instead of 'Ubuntu*' so Ubuntu no longer false-matches UbuntuMono (thread #37) - Download throttle fixed at 8 instead of ProcessorCount to keep network usage bounded on high-core CI hosts (thread #36) - Deduplication test uses a test-only cache tag and cleans up the full directory so no artifacts persist in user cache (thread #38)
1 parent 75feaf4 commit 634c91c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/functions/public/Install-NerdFont.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Please run the command again with elevated rights (Run as Administrator) or prov
135135
if (-not $Force -and $installedFamilies) {
136136
$alreadyInstalled = $false
137137
foreach ($family in $installedFamilies) {
138-
if ($family -like "$fontName*") { $alreadyInstalled = $true; break }
138+
if ($family -like "$fontName Nerd Font*") { $alreadyInstalled = $true; break }
139139
}
140140
if ($alreadyInstalled) {
141141
Write-Verbose "[$fontName] - already installed, skipping"
@@ -151,7 +151,7 @@ Please run the command again with elevated rights (Run as Administrator) or prov
151151
$httpClient.Timeout = [System.Threading.Timeout]::InfiniteTimeSpan
152152
$pending = [System.Collections.Generic.List[object]]::new()
153153
$readyToInstall = [System.Collections.Generic.List[object]]::new()
154-
$throttle = [Math]::Max(1, [Environment]::ProcessorCount)
154+
$throttle = 8
155155

156156
try {
157157
foreach ($nerdFont in $toProcess) {

tests/NerdFonts.Tests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Describe 'Module' {
132132
} else {
133133
Join-Path -Path $HOME -ChildPath '.cache/PSModule/NerdFonts'
134134
}
135-
$cacheTagDir = Join-Path -Path $cacheRoot -ChildPath 'v3.4.0'
135+
$cacheTagDir = Join-Path -Path $cacheRoot -ChildPath 'test-dedup-v0'
136136
$zipPath = Join-Path -Path $cacheTagDir -ChildPath 'DuplicateMonoTest.zip'
137137

138138
try {
@@ -159,7 +159,7 @@ Describe 'Module' {
159159
$script:NerdFonts = @(
160160
[pscustomobject]@{
161161
Name = $fontName
162-
URL = 'https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/DuplicateMonoTest.zip'
162+
URL = 'https://github.com/ryanoasis/nerd-fonts/releases/download/test-dedup-v0/DuplicateMonoTest.zip'
163163
}
164164
)
165165

@@ -177,8 +177,8 @@ Describe 'Module' {
177177
$script:InstalledFontFiles.Count | Should -Be 1
178178
($script:InstalledFontFiles | Select-Object -Unique).Count | Should -Be 1
179179
} finally {
180-
if (Test-Path -LiteralPath $zipPath) {
181-
Remove-Item -LiteralPath $zipPath -Force -ErrorAction SilentlyContinue
180+
if (Test-Path -LiteralPath $cacheTagDir) {
181+
Remove-Item -LiteralPath $cacheTagDir -Recurse -Force -ErrorAction SilentlyContinue
182182
}
183183
$script:NerdFonts = $originalFonts
184184
Remove-Variable -Name InstalledFontFiles -Scope Script -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)