Skip to content

Commit 109bdcf

Browse files
authored
Fix Chocolatey packaging (#84)
1 parent b2affee commit 109bdcf

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Build.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Param
1010
$ModuleAuthor = 'Igor Abade V. Leite',
1111
$ModuleDescription = 'PowerShell Cmdlets for Azure DevOps and Team Foundation Server',
1212
$Targets = "Package",
13-
$RepoCreationDate = (Get-Date '2014-10-24')
13+
$RepoCreationDate = (Get-Date '2014-10-24'),
14+
[switch] $SkipTests
1415
)
1516

1617
Function Install-Dependencies
@@ -187,6 +188,7 @@ try
187188
BuildName = $BuildName
188189
SemVer = $SemVerFullVersion
189190
VersionMetadata = $VersionMetadata
191+
SkipTests = $SkipTests.IsPresent
190192
}
191193

192194
Write-Verbose "=== END PSAKE ==="

psake.ps1

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Updating module manifest file $ModuleManifestPath with the following content:
227227
}
228228
}
229229

230-
Task Test -Depends Build {
230+
Task Test -Depends Build -PreCondition { -not $SkipTests } {
231231

232232
exec {Invoke-Pester -Path $TestsDir -OutputFile (Join-Path $OutDir TestResults.xml) -OutputFormat NUnitXml `
233233
-PesterOption (New-PesterOption -IncludeVSCodeMarker ) -Strict}
@@ -283,7 +283,12 @@ Task PackageModule -Depends Build {
283283
Task PackageNuget -Depends Build, GenerateNuspec {
284284

285285
Copy-Item $ModuleDir $NugetToolsDir\TfsCmdlets -Recurse -Exclude *.ps1 -Force
286-
& $NugetExePath @('Pack', $NugetSpecPath, '-OutputDirectory', $NugetDir, '-Verbosity', 'Detailed', '-NonInteractive') *>&1 | Write-Verbose
286+
287+
$cmdLine = "$NugetExePath Pack $NugetSpecPath -OutputDirectory $NugetDir -Verbosity Detailed -NonInteractive -Version $NugetVersion"
288+
289+
Write-Verbose "Command line: [$cmdLine]"
290+
291+
Invoke-Expression $cmdLine *>&1 | Write-Verbose
287292
}
288293

289294
Task PackageChocolatey -Depends Build {
@@ -296,7 +301,11 @@ Task PackageChocolatey -Depends Build {
296301
Copy-Item $ModuleDir $ChocolateyToolsDir\TfsCmdlets -Recurse -Force
297302
Copy-Item $NugetSpecPath -Destination $ChocolateyDir -Force
298303

299-
& $ChocolateyPath Pack $ChocolateySpecPath -OutputDirectory $ChocolateyDir | Write-Verbose
304+
$cmdLine = "$ChocolateyPath Pack $ChocolateySpecPath -OutputDirectory $ChocolateyDir --Version $Version"
305+
306+
Write-Verbose "Command line: [$cmdLine]"
307+
308+
Invoke-Expression $cmdLine *>&1 | Write-Verbose
300309
}
301310

302311
Task PackageMsi -Depends Build {
@@ -468,7 +477,7 @@ Task GenerateNuspec {
468477
<metadata>
469478
<id>$($SourceManifest.Name)</id>
470479
<title>$($SourceManifest.Name)</title>
471-
<version>$NugetVersion</version>
480+
<version>0.0.0</version>
472481
<authors>$($SourceManifest.Author)</authors>
473482
<owners>$($SourceManifest.Author)</owners>
474483
<licenseUrl>$($SourceManifest.LicenseUri)</licenseUrl>

0 commit comments

Comments
 (0)