From 389de8873e89de348a54266254bbb9196562c90e Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Tue, 12 Dec 2023 14:42:54 +0100 Subject: [PATCH 01/10] Change required modules --- RequiredModules.psd1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RequiredModules.psd1 b/RequiredModules.psd1 index e50a83f4a..34ef28261 100644 --- a/RequiredModules.psd1 +++ b/RequiredModules.psd1 @@ -31,6 +31,7 @@ 'DscResource.Test' = 'latest' xDscResourceDesigner = 'latest' 'DscResource.DocGenerator' = 'latest' + PlatyPS = 'latest' # Build dependencies needed for using the module 'DscResource.Base' = 'latest' @@ -46,9 +47,12 @@ # Need to pin this to 3.7.2 because 4.0.0 made the integration tests fail. PSPKI = '3.7.2' - # Prerequisites modules needed for examples or integration tests + # Prerequisite modules needed for examples or integration tests xPSDesiredStateConfiguration = '9.1.0' StorageDsc = '5.1.0' NetworkingDsc = '9.0.0' WSManDsc = '3.1.1' + + # Prerequisite module for documentation and stub creation. + SqlServer = 'latest' } From 90a0ecb8c37341a46a8da5ef315f164eb21c0ca5 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Tue, 12 Dec 2023 14:46:19 +0100 Subject: [PATCH 02/10] Add build tasks to generate Wiki documentation for public commands --- CHANGELOG.md | 5 ++++ build.yaml | 64 ++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb40e7016..e963a065f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- SqlServerDsc + - Added build tasks to generate Wiki documentation for public commands. + ### Fixed - SqlServerDsc diff --git a/build.yaml b/build.yaml index 28a7db0a6..8f323234f 100644 --- a/build.yaml +++ b/build.yaml @@ -15,6 +15,10 @@ BuildWorkflow: - Generate_Conceptual_Help - Generate_Wiki_Content - Package_WikContent + #- Set_Documentation_Variables + #- Generate_Markdown_For_Public_Commands + #- Generate_External_Help_File_For_Public_Commands + #- Clean_Markdown_Of_Public_Commands fastbuild: - Clean @@ -40,13 +44,6 @@ BuildWorkflow: Package_WikContent: | { - <# - This is quick fix for issue https://github.com/PoshCode/ModuleBuilder/issues/103. - Aliases need to be added to module manifest, and we can only use - New-Alias or Set-Alias together with build tasks. This module - already automatically exports aliases using [Alias()] so this quick - fix is meant as a workaround until the above issue is resolved. - #> param ( $OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')), @@ -74,6 +71,59 @@ BuildWorkflow: Compress-Archive -Path $wikiArchiveSourcePath -DestinationPath $wikiPackagePath -CompressionLevel 'Optimal' -Force -ErrorAction 'Stop' } + Set_Documentation_Variables: | + { + param + ( + $OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')), + # $TestsDirectory = (property TestsDirectory (Join-Path $BuildRoot 'tests')), + # $UnitTestsDirectory = (property UnitTestsDirectory (Join-Path $TestsDirectory 'Unit')), + # $StubDirectory = (property StubDirectory (Join-Path $UnitTestsDirectory 'Stubs')), + $BuildInfo = (property BuildInfo @{ }) + ) + + # Get the vales for task variables, see https://github.com/gaelcolas/Sampler#task-variables. + . Set-SamplerTaskVariable + + "`tProject Name = {0}" -f $ProjectName + "`tOutput Directory = {0}" -f $OutputDirectory + + $wikiOutputPath = Join-Path -Path $OutputDirectory -ChildPath 'WikiContent' + + "`tWiki Output Path = $wikiOutputPath" + + if (-not (Test-Path -Path $wikiOutputPath)) + { + throw 'The Wiki Output Path does not exist. Please run the task Generate_Wiki_Content prior to running this task.' + } + + # Set documentation output folder to the output/WikiContent folder. + $env:DocOutputFolder = $wikiOutputPath + + # Set that New-MarkdownHelpPage should not generate the module page. + $env:WithModulePage = [System.Boolean] $false + + "`tWith Module Page = $env:WithModulePage" + + # "" + + # "`tTests Directory = {0}" -f $TestsDirectory + # "`tUnit Tests Directory = {0}" -f $UnitTestsDirectory + # "`tStub Directory = {0}" -f $StubDirectory + + # $SMOStub = 'SMO.cs' + + # "`tSMO Stubs = {0}" -f $SMOStub + + # $env:DependentType = @(Join-Path -Path $StubDirectory -ChildPath 'SMO.cs') + + # "`tDependent Types = $($env:DependentType -join ', ')" + + $env:DependentModule = 'SqlServer' + + "`tDependent Types = $($env:DependentModule -join ', ')" + } + #################################################### # ModuleBuilder Configuration # #################################################### From 9ee7174a28a86d8c032ce224a4ee2275c14a9c53 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 31 Dec 2023 21:42:13 +0100 Subject: [PATCH 03/10] Fix build tasks --- CHANGELOG.md | 5 ++- RequiredModules.psd1 | 13 ++++--- azure-pipelines.yml | 10 ++++++ build.yaml | 80 +++++++++++--------------------------------- 4 files changed, 43 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e963a065f..87b06659c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update markdown highlights with newly supported keywords. - Bump GitHub Action _Stale_ to v9. - Bump GitHub Action _CodeQL-Action_ to v3. -- SqlSetup + - Documentation is now built using a separate meta task `docs`. + It is run with the meta task `pack` which is run by the pipeline. + To run the meta task `docs` the SMO assemblies must be loaded into the + session, either by importing SqlServer module or loading SMO stubs. - Updated integration tests to use PSResourceGet to download required modules. ## [16.5.0] - 2023-10-05 diff --git a/RequiredModules.psd1 b/RequiredModules.psd1 index 34ef28261..25ec97848 100644 --- a/RequiredModules.psd1 +++ b/RequiredModules.psd1 @@ -30,8 +30,6 @@ MarkdownLinkCheck = 'latest' 'DscResource.Test' = 'latest' xDscResourceDesigner = 'latest' - 'DscResource.DocGenerator' = 'latest' - PlatyPS = 'latest' # Build dependencies needed for using the module 'DscResource.Base' = 'latest' @@ -53,6 +51,13 @@ NetworkingDsc = '9.0.0' WSManDsc = '3.1.1' - # Prerequisite module for documentation and stub creation. - SqlServer = 'latest' + # Prerequisite module for documentation. + #'DscResource.DocGenerator' = 'latest' + 'DscResource.DocGenerator' = @{ + Version = 'latest' + Parameters = @{ + AllowPrerelease = $true + } + } + PlatyPS = 'latest' } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ade6ce3e9..025b0eaa6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,6 +37,16 @@ stages: } Write-Host -Object "##vso[build.updatebuildnumber]$($gitVersionObject.FullSemVer)" displayName: Calculate ModuleVersion (GitVersion) + - pwsh: | + <# + This is intentionally not saved to RequiredModules. It is only + used for creating documentation and should not be part of the + build artifact. + #> + Install-Module -Name SqlServer -Force -Confirm:$false -Verbose + Get-Module -Name SqlServer -ListAvailable | + Select-Object -Property Name,Version,@{Name='Prerelease'; Expression={$_.PrivateData.PSData.Prerelease}}, Path + displayName: Install SqlServer module - task: PowerShell@2 name: package displayName: 'Build & Package Module' diff --git a/build.yaml b/build.yaml index 8f323234f..a90667f48 100644 --- a/build.yaml +++ b/build.yaml @@ -12,21 +12,20 @@ BuildWorkflow: - Build_Module_ModuleBuilder - Build_NestedModules_ModuleBuilder - Create_Changelog_Release_Output + + docs: + - Check_SqlServer_Availability - Generate_Conceptual_Help - Generate_Wiki_Content - - Package_WikContent #- Set_Documentation_Variables - #- Generate_Markdown_For_Public_Commands - #- Generate_External_Help_File_For_Public_Commands - #- Clean_Markdown_Of_Public_Commands - - fastbuild: - - Clean - - Build_Module_ModuleBuilder - - Build_NestedModules_ModuleBuilder + - Generate_Markdown_For_Public_Commands + - Generate_External_Help_File_For_Public_Commands + - Clean_Markdown_Of_Public_Commands + - Package_WikContent pack: - build + - docs - package_module_nupkg # cSpell: disable-line hqrmtest: # cSpell: disable-line @@ -42,6 +41,18 @@ BuildWorkflow: - Publish_Module_To_gallery - Publish_GitHub_Wiki_Content + Check_SqlServer_Availability: | + { + try + { + [Microsoft.SqlServer.Management.Smo.Server] -as [Type] | Out-Null + } + catch + { + throw 'The SqlServer types are not available. Please install the SqlServer module or load SMO stubs types and try again.' + } + } + Package_WikContent: | { param @@ -71,58 +82,7 @@ BuildWorkflow: Compress-Archive -Path $wikiArchiveSourcePath -DestinationPath $wikiPackagePath -CompressionLevel 'Optimal' -Force -ErrorAction 'Stop' } - Set_Documentation_Variables: | - { - param - ( - $OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')), - # $TestsDirectory = (property TestsDirectory (Join-Path $BuildRoot 'tests')), - # $UnitTestsDirectory = (property UnitTestsDirectory (Join-Path $TestsDirectory 'Unit')), - # $StubDirectory = (property StubDirectory (Join-Path $UnitTestsDirectory 'Stubs')), - $BuildInfo = (property BuildInfo @{ }) - ) - - # Get the vales for task variables, see https://github.com/gaelcolas/Sampler#task-variables. - . Set-SamplerTaskVariable - - "`tProject Name = {0}" -f $ProjectName - "`tOutput Directory = {0}" -f $OutputDirectory - - $wikiOutputPath = Join-Path -Path $OutputDirectory -ChildPath 'WikiContent' - - "`tWiki Output Path = $wikiOutputPath" - - if (-not (Test-Path -Path $wikiOutputPath)) - { - throw 'The Wiki Output Path does not exist. Please run the task Generate_Wiki_Content prior to running this task.' - } - - # Set documentation output folder to the output/WikiContent folder. - $env:DocOutputFolder = $wikiOutputPath - # Set that New-MarkdownHelpPage should not generate the module page. - $env:WithModulePage = [System.Boolean] $false - - "`tWith Module Page = $env:WithModulePage" - - # "" - - # "`tTests Directory = {0}" -f $TestsDirectory - # "`tUnit Tests Directory = {0}" -f $UnitTestsDirectory - # "`tStub Directory = {0}" -f $StubDirectory - - # $SMOStub = 'SMO.cs' - - # "`tSMO Stubs = {0}" -f $SMOStub - - # $env:DependentType = @(Join-Path -Path $StubDirectory -ChildPath 'SMO.cs') - - # "`tDependent Types = $($env:DependentType -join ', ')" - - $env:DependentModule = 'SqlServer' - - "`tDependent Types = $($env:DependentModule -join ', ')" - } #################################################### # ModuleBuilder Configuration # From 84b677526fe3c2fe09212e6fd9d31a45874fc8c7 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 31 Dec 2023 21:45:53 +0100 Subject: [PATCH 04/10] Fix typos --- RequiredModules.psd1 | 2 +- build.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/RequiredModules.psd1 b/RequiredModules.psd1 index 25ec97848..4ba54f838 100644 --- a/RequiredModules.psd1 +++ b/RequiredModules.psd1 @@ -51,7 +51,7 @@ NetworkingDsc = '9.0.0' WSManDsc = '3.1.1' - # Prerequisite module for documentation. + # Prerequisite modules for documentation. #'DscResource.DocGenerator' = 'latest' 'DscResource.DocGenerator' = @{ Version = 'latest' diff --git a/build.yaml b/build.yaml index a90667f48..35b4d9f7b 100644 --- a/build.yaml +++ b/build.yaml @@ -17,7 +17,6 @@ BuildWorkflow: - Check_SqlServer_Availability - Generate_Conceptual_Help - Generate_Wiki_Content - #- Set_Documentation_Variables - Generate_Markdown_For_Public_Commands - Generate_External_Help_File_For_Public_Commands - Clean_Markdown_Of_Public_Commands From 9a2f38d5f2b8932affcfae5ae7d0fb2acc13248e Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 31 Dec 2023 21:54:57 +0100 Subject: [PATCH 05/10] Fix pipeline --- azure-pipelines.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 025b0eaa6..d3db63d44 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,6 +43,11 @@ stages: used for creating documentation and should not be part of the build artifact. #> + Write-Information -MessageData 'Removing SqlServer and SQLPS from the CI worker.' -InformationAction Continue + Import-Module -Name ./tests/TestHelpers/CommonTestHelper.psm1 + Remove-PowerShellModuleFromCI -Name @('SqlServer', 'SQLPS') + Remove-Module -Name CommonTestHelper + Write-Information -MessageData 'Installing latest SqlServer on the CI worker' -InformationAction Continue Install-Module -Name SqlServer -Force -Confirm:$false -Verbose Get-Module -Name SqlServer -ListAvailable | Select-Object -Property Name,Version,@{Name='Prerelease'; Expression={$_.PrivateData.PSData.Prerelease}}, Path From 2caa47c6e9a5ec1dd5721eedd5b96a55a845e343 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 31 Dec 2023 22:02:41 +0100 Subject: [PATCH 06/10] Fix build task --- build.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build.yaml b/build.yaml index 35b4d9f7b..ddc150e1c 100644 --- a/build.yaml +++ b/build.yaml @@ -42,14 +42,16 @@ BuildWorkflow: Check_SqlServer_Availability: | { - try - { - [Microsoft.SqlServer.Management.Smo.Server] -as [Type] | Out-Null - } - catch - { - throw 'The SqlServer types are not available. Please install the SqlServer module or load SMO stubs types and try again.' - } + Import-Module -Name SqlServer -ErrorAction 'SilentlyContinue' + + try + { + [Microsoft.SqlServer.Management.Smo.Server] -as [Type] | Out-Null + } + catch + { + throw 'The SqlServer types are not available. Please install the SqlServer module or load SMO stubs types and try again.' + } } Package_WikContent: | From 71ebe99eba1091aee5c7ae9749073837022f1f13 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 31 Dec 2023 23:45:58 +0100 Subject: [PATCH 07/10] Fix QA tests --- CHANGELOG.md | 5 ++ tests/QA/module.tests.ps1 | 121 ++++++++++++++------------------------ 2 files changed, 50 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b06659c..b30ae9f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SqlServerDsc - Added build tasks to generate Wiki documentation for public commands. + - QA test to verify that each public command's script file starts with a + new line (needed until PR https://github.com/PoshCode/ModuleBuilder/pull/127 + is merged and released). ### Fixed @@ -44,6 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 It is run with the meta task `pack` which is run by the pipeline. To run the meta task `docs` the SMO assemblies must be loaded into the session, either by importing SqlServer module or loading SMO stubs. + - QA test improved to speed up quality testing. +- SqlSetup - Updated integration tests to use PSResourceGet to download required modules. ## [16.5.0] - 2023-10-05 diff --git a/tests/QA/module.tests.ps1 b/tests/QA/module.tests.ps1 index 21c019cca..3db37dce3 100644 --- a/tests/QA/module.tests.ps1 +++ b/tests/QA/module.tests.ps1 @@ -102,7 +102,7 @@ Describe 'Changelog Management' -Tag 'Changelog' { } It 'Changelog should have an Unreleased header' -Skip:$skipTest { - (Get-ChangelogData -Path (Join-Path -Path $ProjectPath -ChildPath 'CHANGELOG.md') -ErrorAction Stop).Unreleased | Should -Not -BeNullOrEmpty + (Get-ChangelogData -Path (Join-Path -Path $ProjectPath -ChildPath 'CHANGELOG.md') -ErrorAction Stop).Unreleased | Should -Not -BeNullOrEmpty } } @@ -125,14 +125,25 @@ BeforeDiscovery { $allModuleFunctions = & $mut { Get-Command -Module $args[0] -CommandType Function } $script:moduleName # Build test cases. - $testCases = @() + $testCasesAllModuleFunction = @() foreach ($function in $allModuleFunctions) { - $testCases += @{ + $testCasesAllModuleFunction += @{ Name = $function.Name } } + + $allPublicCommand = (Get-Command -Module $script:moduleName).Name + + $testCasesPublicCommand = @() + + foreach ($command in $allPublicCommand) + { + $testCasesPublicCommand += @{ + Name = $command + } + } } Describe 'Quality for module' -Tags 'TestQuality' { @@ -154,11 +165,11 @@ Describe 'Quality for module' -Tags 'TestQuality' { } } - It 'Should have a unit test for ' -ForEach $testCases { + It 'Should have a unit test for ' -ForEach $testCasesAllModuleFunction { Get-ChildItem -Path 'tests\' -Recurse -Include "$Name.Tests.ps1" | Should -Not -BeNullOrEmpty } - It 'Should pass Script Analyzer for ' -ForEach $testCases -Skip:(-not $scriptAnalyzerRules) { + It 'Should pass Script Analyzer for ' -ForEach $testCasesAllModuleFunction -Skip:(-not $scriptAnalyzerRules) { $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include "$Name.ps1" $pssaResult = (Invoke-ScriptAnalyzer -Path $functionFile.FullName) @@ -169,88 +180,46 @@ Describe 'Quality for module' -Tags 'TestQuality' { } Describe 'Help for module' -Tags 'helpQuality' { - It 'Should have .SYNOPSIS for ' -ForEach $testCases { - $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include "$Name.ps1" - - $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName - - $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null) + Context 'Validating help for ' -ForEach $testCasesAllModuleFunction -Tag 'helpQuality' { + BeforeAll { + $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include "$Name.ps1" - $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] } + $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName - $parsedFunction = $abstractSyntaxTree.FindAll( $astSearchDelegate, $true ) | - Where-Object -FilterScript { - $_.Name -eq $Name - } + $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null) - $functionHelp = $parsedFunction.GetHelpContent() + $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] } - $functionHelp.Synopsis | Should -Not -BeNullOrEmpty - } - - It 'Should have a .DESCRIPTION with length greater than 40 characters for ' -ForEach $testCases { - $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include "$Name.ps1" - - $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName - - $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null) - - $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] } - - $parsedFunction = $abstractSyntaxTree.FindAll($astSearchDelegate, $true) | - Where-Object -FilterScript { - $_.Name -eq $Name - } - - $functionHelp = $parsedFunction.GetHelpContent() - - $functionHelp.Description.Length | Should -BeGreaterThan 40 - } + $parsedFunction = $abstractSyntaxTree.FindAll( $astSearchDelegate, $true ) | + Where-Object -FilterScript { + $_.Name -eq $Name + } - It 'Should have at least one (1) example for ' -ForEach $testCases { - $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include "$Name.ps1" - - $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName - - $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null) - - $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] } - - $parsedFunction = $abstractSyntaxTree.FindAll( $astSearchDelegate, $true ) | - Where-Object -FilterScript { - $_.Name -eq $Name - } - - $functionHelp = $parsedFunction.GetHelpContent() - - $functionHelp.Examples.Count | Should -BeGreaterThan 0 - $functionHelp.Examples[0] | Should -Match ([regex]::Escape($function.Name)) - $functionHelp.Examples[0].Length | Should -BeGreaterThan ($function.Name.Length + 10) - - } + $script:functionHelp = $parsedFunction.GetHelpContent() + } - It 'Should have described all parameters for ' -ForEach $testCases { - $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include "$Name.ps1" + It 'Should have .SYNOPSIS' { + $functionHelp.Synopsis | Should -Not -BeNullOrEmpty + } - $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName + It 'Should have a .DESCRIPTION with length greater than 40 characters for ' { + $functionHelp.Description.Length | Should -BeGreaterThan 40 + } - $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null) + It 'Should have at least one (1) example for ' { + $functionHelp.Examples.Count | Should -BeGreaterThan 0 + $functionHelp.Examples[0] | Should -Match ([regex]::Escape($function.Name)) + $functionHelp.Examples[0].Length | Should -BeGreaterThan ($function.Name.Length + 10) + } - $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] } + It 'Should have described all parameters for ' { + $parameters = $parsedFunction.Body.ParamBlock.Parameters.Name.VariablePath.ForEach({ $_.ToString() }) - $parsedFunction = $abstractSyntaxTree.FindAll( $astSearchDelegate, $true ) | - Where-Object -FilterScript { - $_.Name -eq $Name + foreach ($parameter in $parameters) + { + $functionHelp.Parameters.($parameter.ToUpper()) | Should -Not -BeNullOrEmpty -Because ('the parameter {0} must have a description' -f $parameter) + $functionHelp.Parameters.($parameter.ToUpper()).Length | Should -BeGreaterThan 25 -Because ('the parameter {0} must have descriptive description' -f $parameter) } - - $functionHelp = $parsedFunction.GetHelpContent() - - $parameters = $parsedFunction.Body.ParamBlock.Parameters.Name.VariablePath.ForEach({ $_.ToString() }) - - foreach ($parameter in $parameters) - { - $functionHelp.Parameters.($parameter.ToUpper()) | Should -Not -BeNullOrEmpty -Because ('the parameter {0} must have a description' -f $parameter) - $functionHelp.Parameters.($parameter.ToUpper()).Length | Should -BeGreaterThan 25 -Because ('the parameter {0} must have descriptive description' -f $parameter) } } } From 4fe7c86fd026e244aa9ea89ee975b3cd947808e8 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 31 Dec 2023 23:51:50 +0100 Subject: [PATCH 08/10] Fix blank lines --- build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.yaml b/build.yaml index ddc150e1c..b26c0628f 100644 --- a/build.yaml +++ b/build.yaml @@ -83,8 +83,6 @@ BuildWorkflow: Compress-Archive -Path $wikiArchiveSourcePath -DestinationPath $wikiPackagePath -CompressionLevel 'Optimal' -Force -ErrorAction 'Stop' } - - #################################################### # ModuleBuilder Configuration # #################################################### From b879bc24131d3ebb86da78816a324ace33ed1054 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 14 Jan 2024 15:34:19 +0100 Subject: [PATCH 09/10] Update build configuration --- build.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build.yaml b/build.yaml index b26c0628f..542ba55d7 100644 --- a/build.yaml +++ b/build.yaml @@ -20,6 +20,8 @@ BuildWorkflow: - Generate_Markdown_For_Public_Commands - Generate_External_Help_File_For_Public_Commands - Clean_Markdown_Of_Public_Commands + - Generate_Wiki_Sidebar + - Clean_Markdown_Metadata - Package_WikContent pack: @@ -216,3 +218,18 @@ DscResource.DocGenerator: - '_(.+?)_' # Match Italic (underscore) - '\*\*(.+?)\*\*' # Match bold - '\*(.+?)\*' # Match Italic (asterisk) + Publish_GitHub_Wiki_Content: + Debug: false + Generate_Wiki_Content: + MofResourceMetadata: + Type: MofResource + Category: Resources + ClassResourceMetadata: + Type: ClassResource + Category: Resources + CompositeResourceMetadata: + Type: CompositeResource + Category: Resources + Generate_Wiki_Sidebar: + Debug: false + AlwaysOverwrite: true From 19e14f01231ede8482a6687aefb72c00bbacfdc0 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Wed, 17 Jan 2024 18:02:56 +0100 Subject: [PATCH 10/10] Fix CHANGELOG after rebase --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b30ae9f36..07e06d7d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SqlServerDsc - Added build tasks to generate Wiki documentation for public commands. - - QA test to verify that each public command's script file starts with a - new line (needed until PR https://github.com/PoshCode/ModuleBuilder/pull/127 - is merged and released). ### Fixed