Skip to content

Latest commit

 

History

History
115 lines (80 loc) · 2.97 KB

BUILD.md

File metadata and controls

115 lines (80 loc) · 2.97 KB

BUILD

Testing

Run all the tests:

Invoke-Pester .\test\

To use the code coverage assessment use -CodeCoverage:

$res = Invoke-Pester .\test\ -CodeCoverage ..\PowerGRR.psm1 -PassThru

The result can be read in the following manner:

PS> $res.TotalCount
11
PS> $res.FailedCount
0
PS> $res.PassedCount
11

Source Code Analyzer

Invoke-ScriptAnalyzer -Path .\PowerGRR\

Module Manifest

Create new module manifest

New-ModuleManifest -Path .\PowerGRR.psd1 -RootModule PowerGRR.psm1 -Author "Swisscom (Schweiz) AG" -CompanyName 'Swisscom (Schweiz) AG' -ModuleVersion '0.1.0'

Generating Help

New Markdown Help

Build the markdown help with the following commands for a new documentation or for a new cmdlet in later stages.

  1. Import module
Import-Module .\PowerGRR.psd1 -Force
  1. Create new markdown help for module...
New-MarkdownHelp -Module PowerGRR -OutputFolder .\docs\ -WithModulePage -Force -HelpVersion "1.0.0.0"
  1. or create a markdown file for a specific cmdlet. When doing this it's possible to add the online URL to the help. This allows using "-Online" with the help command to display the online help.
New-MarkdownHelp -Command Get-GRRFlowInfo -OutputFolder .\docs\ -OnlineVersionUrl "https://github.com/swisscom/PowerGRR/blob/master/docs/Get-GRRFlowInfo.md" 

Important: After creating a new help file for one specific command it must be added manually to the PowerGRR.md in /docs.

Update Markdown Help

To update the markdown use the following commands.

Import-Module .\PowerGRR.psd1 -Force
Update-MarkdownHelp .\docs\

PowerShell External Help

Use the following command to create the PowerShell external help file (use -force to update an existing external help file).

New-ExternalHelp -Path .\docs\ -OutputPath en-us\ -Force

Tags file for PowerShell

PowerShell

Use the following ctags configuration for PowerShell. Run the command within the PowerGRR root directory.

ctags.cnf (variables disabled through the regex)

--langdef=powershell
--langmap=powershell:.psm1.ps1
--regex-powershell=/function\s+(script:)?([a-zA-Z\-]+)/\2/m, method/i
--exclude=test

Use the folloging ctags command to generate the PowerShell tags.

ctags -R --languages=powershell

Pester

Use the following ctags configuration for Pester. Run the command within the Pester test directory.

ctags -R --langdef=pester --langmap=pester:.ps1 --regex-pester="/describe\s+'(.*)'/\1/m, method/i"

References