1- properties {
1+ Properties {
22 $settings = . ([IO.Path ]::Combine($PSScriptRoot , ' build.settings.ps1' ))
33 if ($galleryApiKey ) {
44 $settings.PSGalleryApiKey = $galleryApiKey.GetNetworkCredential ().password
55 }
66}
77
8- task default - depends Test
8+ Task default - depends Test
99
10- task Init {
10+ Task Init {
1111 " STATUS: Testing with PowerShell $ ( $settings.PSVersion ) "
1212 ' Build System Details:'
1313 Get-Item ENV:BH*
1414} - description ' Initialize build environment'
1515
16- task Test - Depends Init, Analyze, Pester - description ' Run test suite'
16+ Task Test - depends Init, Analyze, Pester - description ' Run test suite'
1717
18- task Analyze - depends Build {
19- $analysis = Invoke-ScriptAnalyzer - Path $settings.ModuleOutDir - Recurse - Verbose:$false - Settings ([IO.Path ]::Combine($ env: BHModulePath , ' ScriptAnalyzerSettings.psd1' ))
20- $errors = $analysis | Where-Object {$_.Severity -eq ' Error' }
21- $warnings = $analysis | Where-Object {$_.Severity -eq ' Warning' }
18+ Task Analyze - depends Build {
19+ $analysis = Invoke-ScriptAnalyzer - Path $settings.ModuleOutDir - Recurse - Verbose:$false - Settings ([IO.Path ]::Combine(' tests ' , ' ScriptAnalyzerSettings.psd1' ))
20+ $errors = $analysis | Where-Object { $_.Severity -eq ' Error' }
21+ $warnings = $analysis | Where-Object { $_.Severity -eq ' Warning' }
2222 if (@ ($errors ).Count -gt 0 ) {
2323 Write-Error - Message ' One or more Script Analyzer errors were found. Build cannot continue!'
2424 $errors | Format-Table - AutoSize
@@ -30,25 +30,25 @@ task Analyze -depends Build {
3030 }
3131} - description ' Run PSScriptAnalyzer'
3232
33- task Pester - depends Build {
33+ Task Pester - depends Build {
3434 Remove-Module $settings.ProjectName - ErrorAction SilentlyContinue - Verbose:$false
3535
3636 $testResultsXml = [IO.Path ]::Combine($settings.OutputDir , ' testResults.xml' )
37- $testResults = Invoke-Pester - Path $settings.Tests - Output Detailed - PassThru
37+ $testResults = Invoke-Pester - Path $settings.Tests - Output Detailed - PassThru
3838
3939 if ($testResults.FailedCount -gt 0 ) {
4040 $testResults | Format-List
4141 Write-Error - Message ' One or more Pester tests failed. Build cannot continue!'
4242 }
4343} - description ' Run Pester tests'
4444
45- task Clean - depends Init {
45+ Task Clean - depends Init {
4646 if (Test-Path - Path $settings.ModuleOutDir ) {
4747 Remove-Item - Path $settings.ModuleOutDir - Recurse - Force - Verbose:$false
4848 }
4949}
5050
51- task Build - depends Init, Clean {
51+ Task Build - depends Init, Clean {
5252 New-Item - Path $settings.ModuleOutDir - ItemType Directory - Force > $null
5353 Copy-Item - Path " $ ( $settings.SUT ) /*" - Destination $settings.ModuleOutDir - Recurse
5454
@@ -59,7 +59,7 @@ task Build -depends Init, Clean {
5959 # & .\Build\Convert-PSAke.ps1 $psakePath | Out-File -Encoding UTF8 $ibPath
6060}
6161
62- task Publish - depends Test {
62+ Task Publish - depends Test {
6363 " Publishing version [$ ( $settings.Manifest.ModuleVersion ) ] to PSGallery..."
6464 if ($settings.PSGalleryApiKey ) {
6565 Publish-Module - Path $settings.ModuleOutDir - NuGetApiKey $settings.PSGalleryApiKey
0 commit comments