Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packaging/chocolatey/devnav.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>DevNav</title>
<authors>JacobOptimiza</authors>
<owners>JacobOptimiza</owners>
<copyright>Copyright (c) 2026 JacobOptimiza</copyright>
<licenseUrl>https://github.com/JacobOptimiza/dev-nav/blob/main/LICENSE</licenseUrl>
<projectUrl>https://github.com/JacobOptimiza/dev-nav</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
3 changes: 2 additions & 1 deletion packaging/chocolatey/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ $assets = @{
}
}
$selected = Get-DevNavAssetSet -Architecture $architecture -Assets $assets
$packageTools = Join-Path $env:ChocolateyPackageFolder 'tools'
$packageRoot = Get-ChocolateyPath -PathType 'PackagePath'
$packageTools = Join-Path $packageRoot 'tools'
$moduleRoot = Join-Path $packageTools 'DevNav'
New-Item -ItemType Directory -Path $moduleRoot -Force | Out-Null

Expand Down
3 changes: 2 additions & 1 deletion packaging/chocolatey/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'DevNavChocolatey.ps1')
Remove-DevNavMachineModulePath -PackageTools (Join-Path $env:ChocolateyPackageFolder 'tools')
$packageRoot = Get-ChocolateyPath -PathType 'PackagePath'
Remove-DevNavMachineModulePath -PackageTools (Join-Path $packageRoot 'tools')
34 changes: 34 additions & 0 deletions tests/powershell/ChocolateyPackaging.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Describe 'Chocolatey package source contract' {
$nuspec = Get-Content (Join-Path $output 'devnav.nuspec') -Raw
$install = Get-Content (Join-Path $output 'tools\chocolateyInstall.ps1') -Raw
$nuspec | Should -Match '<version>9\.8\.7</version>'
$nuspec | Should -Match '<copyright>Copyright \(c\) 2026 JacobOptimiza</copyright>'
$install | Should -Match 'releases/download/v9\.8\.7/dev-windows-x86_64\.exe'
$install | Should -Match ('a' * 64)
$install | Should -Not -Match '__[A-Z0-9_]+__'
Expand All @@ -72,4 +73,37 @@ Describe 'Chocolatey package source contract' {
}
finally { Remove-Item -LiteralPath $path -Force -ErrorAction SilentlyContinue }
}

It 'uses the supported package path API and no CPMR0072 private variables' {
$root = Join-Path ([IO.Path]::GetTempPath()) ('devnav-choco-contract-' + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $root | Out-Null
try {
$manifest = [ordered]@{
schemaVersion = 1
version = '9.8.7'
artifacts = [ordered]@{
'binary-x64' = @{ file = 'dev-windows-x86_64.exe'; sha256 = ('a' * 64) }
'binary-arm64' = @{ file = 'dev-windows-aarch64.exe'; sha256 = ('b' * 64) }
module = @{ file = 'DevNav.psm1'; sha256 = ('c' * 64) }
'module-manifest' = @{ file = 'DevNav.psd1'; sha256 = ('d' * 64) }
}
}
$manifestPath = Join-Path $root 'release-manifest.json'
$manifest | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath $manifestPath -Encoding utf8NoBOM
$output = Join-Path $root 'package'
& $script:materializerPath -Version '9.8.7' -ReleaseManifest $manifestPath -OutputDirectory $output | Out-Null
$scripts = Get-ChildItem (Join-Path $output 'tools') -File -Filter '*.ps*' -Recurse |
ForEach-Object { Get-Content -LiteralPath $_.FullName -Raw }
$scripts -join "`n" | Should -Match 'Get-ChocolateyPath -PathType ''PackagePath'''
foreach ($variable in @(
'chocolateyToolsLocation', 'chocolateyBinRoot', 'chocolatey_bin_root',
'chocolateyPackageFolder', 'packageFolder', 'chocolateyChecksum32',
'chocolateyChecksum64', 'chocolateyChecksumType32',
'chocolateyChecksumType64', 'downloadCacheAvailable'
)) {
$scripts -join "`n" | Should -Not -Match ([regex]::Escape("`$env:$variable"))
}
}
finally { Remove-Item -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue }
}
}