Skip to content

Commit

Permalink
Fix Chocolatey packaging (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
igoravl authored Aug 24, 2019
1 parent b2affee commit 109bdcf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Param
$ModuleAuthor = 'Igor Abade V. Leite',
$ModuleDescription = 'PowerShell Cmdlets for Azure DevOps and Team Foundation Server',
$Targets = "Package",
$RepoCreationDate = (Get-Date '2014-10-24')
$RepoCreationDate = (Get-Date '2014-10-24'),
[switch] $SkipTests
)

Function Install-Dependencies
Expand Down Expand Up @@ -187,6 +188,7 @@ try
BuildName = $BuildName
SemVer = $SemVerFullVersion
VersionMetadata = $VersionMetadata
SkipTests = $SkipTests.IsPresent
}

Write-Verbose "=== END PSAKE ==="
Expand Down
17 changes: 13 additions & 4 deletions psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Updating module manifest file $ModuleManifestPath with the following content:
}
}

Task Test -Depends Build {
Task Test -Depends Build -PreCondition { -not $SkipTests } {

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

Copy-Item $ModuleDir $NugetToolsDir\TfsCmdlets -Recurse -Exclude *.ps1 -Force
& $NugetExePath @('Pack', $NugetSpecPath, '-OutputDirectory', $NugetDir, '-Verbosity', 'Detailed', '-NonInteractive') *>&1 | Write-Verbose

$cmdLine = "$NugetExePath Pack $NugetSpecPath -OutputDirectory $NugetDir -Verbosity Detailed -NonInteractive -Version $NugetVersion"

Write-Verbose "Command line: [$cmdLine]"

Invoke-Expression $cmdLine *>&1 | Write-Verbose
}

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

& $ChocolateyPath Pack $ChocolateySpecPath -OutputDirectory $ChocolateyDir | Write-Verbose
$cmdLine = "$ChocolateyPath Pack $ChocolateySpecPath -OutputDirectory $ChocolateyDir --Version $Version"

Write-Verbose "Command line: [$cmdLine]"

Invoke-Expression $cmdLine *>&1 | Write-Verbose
}

Task PackageMsi -Depends Build {
Expand Down Expand Up @@ -468,7 +477,7 @@ Task GenerateNuspec {
<metadata>
<id>$($SourceManifest.Name)</id>
<title>$($SourceManifest.Name)</title>
<version>$NugetVersion</version>
<version>0.0.0</version>
<authors>$($SourceManifest.Author)</authors>
<owners>$($SourceManifest.Author)</owners>
<licenseUrl>$($SourceManifest.LicenseUri)</licenseUrl>
Expand Down

0 comments on commit 109bdcf

Please sign in to comment.