Skip to content
This repository was archived by the owner on Feb 24, 2021. It is now read-only.

Commit b378b26

Browse files
authored
Merge branch 'dev' into WikiPages-Update
2 parents e959c32 + 6c6cbb3 commit b378b26

File tree

2 files changed

+57
-42
lines changed

2 files changed

+57
-42
lines changed

CHANGELOG.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@
77
- Added issue templates.
88
- Added the ability to temporary skip common test for debugging purposes
99
([issue #219](https://github.com/PowerShell/DscResource.Tests/issues/219)).
10-
- Added functionality to Install-ModuleFromPowerShellGallery helper function to allow using Nuget.exe
11-
when it is already installed in the temp path. Addresses ([issue #301](https://github.com/PowerShell/DscResource.Tests/issues/301)).
12-
- Updated Unit tests to reflect the changes to the Install-ModuleFromPowerShellGallery helper function
13-
- Added a RequiredVersion for PSPKI (v3.3.0.0) in TestHelper because of a critical
14-
issue in the recently released version (v3.4.0.1) of that module.
15-
- Improved Wiki documentation generation to address more example file types
16-
and increased unit test coverage and function ([issue #256](https://github.com/PowerShell/DscResource.Tests/issues/256)).
17-
- Added .gitignore file and suppressed ```package-lock.json``` file from being
18-
included in repo.
10+
- Added functionality to Install-ModuleFromPowerShellGallery helper function
11+
to allow using Nuget.exe when it is already installed in the temp path.
12+
Addresses ([issue #301](https://github.com/PowerShell/DscResource.Tests/issues/301)).
13+
- Updated Unit tests to reflect the changes to the Install-ModuleFromPowerShellGallery
14+
helper function.
15+
- Added a RequiredVersion for PSPKI (v3.3.0.0) in TestHelper because of
16+
a critical issue in the recently released version (v3.4.0.1) of that
17+
module.
18+
- Improved Wiki documentation generation to address more example file
19+
types and increased unit test coverage and function
20+
([issue #256](https://github.com/PowerShell/DscResource.Tests/issues/256)).
21+
- Added .gitignore file and suppressed ```package-lock.json``` file from
22+
being included in repo.
1923
- Changes to AppVeyor.psm1
20-
- Updated Invoke-AppveyorInstallTask to provide better informational messages
21-
when installing each prerequisite
24+
- Updated Invoke-AppveyorInstallTask to provide better informational
25+
messages when installing each prerequisite
2226
([issue #293](https://github.com/PowerShell/DscResource.Tests/issues/293)).
2327
- Added unit tests for Invoke-AppveyorInstallTask.
2428
- Changes to TestHelper.psm1
@@ -28,13 +32,12 @@
2832
correct download URL is now concatenated withing the helper function.
2933
- Now outputs a warning when a repository does not have a Tests folder
3034
([issue #296](https://github.com/PowerShell/DscResource.Tests/issues/296)).
31-
- Update PSSA rule Measure-IfStatement to handle when there is a clause spanning
32-
multiple rows and the first rows ends correctly with an open brace (see example
33-
in the regression test for this issue)
35+
- Update PSSA rule Measure-IfStatement to handle when there is a clause
36+
spanning multiple rows and the first rows ends correctly with an open
37+
brace (see example in the regression test for this issue)
3438
([issue #238](https://github.com/PowerShell/DscResource.Tests/issues/238)).
35-
- Update call to install PowerShellGet via Install-Module in AppVeyor.psm1 to
36-
use AllowClobber
37-
([issue #310](https://github.com/PowerShell/DscResource.Tests/issues/310)).
39+
- Update call to install PowerShellGet via Install-Module in AppVeyor.psm1
40+
to use AllowClobber ([issue #310](https://github.com/PowerShell/DscResource.Tests/issues/310)).
3841
- Fix MetaFixers Functions Pipeline Processing.
3942
- Added common opt-in tests for localization ([issue #145](https://github.com/PowerShell/DscResource.Tests/issues/145)).
4043
- Should have an en-US localization folder.
@@ -63,6 +66,11 @@
6366
the resource specific path and fix the example processing.
6467
- Added processing to `Test-PublishMetaData` for the InvalidGUID error from Test-ScriptFileInfo
6568
([issue #330](https://github.com/PowerShell/DscResource.Tests/issues/330)).
69+
- Update New-DscResourcePowerShellHelp to optionally output the PowerShell
70+
help files to the resource specific path and fix the example processing.
71+
- The files are now outputted as UTF-8 (ASCII).
72+
- Added processing to `Test-PublishMetaData` for the InvalidGUID error
73+
from Test-ScriptFileInfo ([issue #330](https://github.com/PowerShell/DscResource.Tests/issues/330)).
6674

6775
## 0.3.0.0
6876

DscResource.DocumentationHelper/PowerShellHelp.psm1

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,44 +24,43 @@ $moduleName = $ExecutionContext.SessionState.Module
2424
$script:localizedData = Get-LocalizedData -ModuleName $moduleName -ModuleRoot $PSScriptRoot
2525

2626
<#
27-
.SYNOPSIS
28-
New-DscResourcePowerShellHelp generates PowerShell compatible help files for a DSC
29-
resource module
30-
31-
.DESCRIPTION
32-
The New-DscResourcePowerShellHelp cmdlet will review all of the MOF based resources
33-
in a specified module directory and will inject PowerShell help files for each resource.
34-
These help files include details on the property types for each resource, as well as a text
35-
description and examples where they exist.
27+
.SYNOPSIS
28+
New-DscResourcePowerShellHelp generates PowerShell compatible help files for a DSC
29+
resource module
3630
37-
The help files are output to the OutputPath directory if specified, or if not, they are
38-
output to the releveant resource's 'en-US' directory.
31+
.DESCRIPTION
32+
The New-DscResourcePowerShellHelp cmdlet will review all of the MOF based resources
33+
in a specified module directory and will inject PowerShell help files for each resource.
34+
These help files include details on the property types for each resource, as well as a text
35+
description and examples where they exist.
3936
40-
A README.md with a text description must exist in the resource's subdirectory for the
41-
help file to be generated.
37+
The help files are output to the OutputPath directory if specified, or if not, they are
38+
output to the releveant resource's 'en-US' directory.
4239
43-
These help files can then be read by passing the name of the resource as a parameter to Get-Help.
40+
A README.md with a text description must exist in the resource's subdirectory for the
41+
help file to be generated.
4442
45-
.PARAMETER ModulePath
46-
The path to the root of the DSC resource module (where the PSD1 file is found, not the folder for
47-
each individual DSC resource)
43+
These help files can then be read by passing the name of the resource as a parameter to Get-Help.
4844
49-
.EXAMPLE
50-
This example shows how to generate help for a specific module
45+
.PARAMETER ModulePath
46+
The path to the root of the DSC resource module (where the PSD1 file is found, not the folder for
47+
each individual DSC resource)
5148
52-
New-DscResourcePowerShellHelp -ModulePath C:\repos\SharePointdsc
49+
.EXAMPLE
50+
This example shows how to generate help for a specific module
5351
52+
New-DscResourcePowerShellHelp -ModulePath C:\repos\SharePointdsc
5453
#>
5554
function New-DscResourcePowerShellHelp
5655
{
5756
[CmdletBinding()]
5857
param
5958
(
60-
[parameter(Mandatory = $true)]
59+
[Parameter(Mandatory = $true)]
6160
[System.String]
6261
$ModulePath,
6362

64-
[parameter()]
63+
[Parameter()]
6564
[System.String]
6665
$OutputPath
6766
)
@@ -70,14 +69,17 @@ function New-DscResourcePowerShellHelp
7069

7170
$mofSearchPath = (Join-Path -Path $ModulePath -ChildPath '\**\*.schema.mof')
7271
$mofSchemas = Get-ChildItem -Path $mofSearchPath -Recurse
72+
7373
Write-Verbose -Message ($script:localizedData.FoundMofFilesMessage -f $mofSchemas.Count, $ModulePath)
74+
7475
$mofSchemas | ForEach-Object {
7576
$mofFileObject = $_
7677

7778
$result = (Get-MofSchemaObject -FileName $_.FullName) | Where-Object -FilterScript {
7879
($_.ClassName -eq $mofFileObject.Name.Replace('.schema.mof', '')) `
7980
-and ($null -ne $_.FriendlyName)
8081
}
82+
8183
$descriptionPath = Join-Path -Path $mofFileObject.DirectoryName -ChildPath 'readme.md'
8284

8385
if (Test-Path -Path $descriptionPath)
@@ -89,8 +91,11 @@ function New-DscResourcePowerShellHelp
8991
$output += [Environment]::NewLine + [Environment]::NewLine
9092

9193
$descriptionContent = Get-Content -Path $descriptionPath -Raw
92-
$descriptionContent = $descriptionContent -replace "\n", "`n "
93-
$descriptionContent = $descriptionContent -replace "# Description\r\n ", ".DESCRIPTION"
94+
95+
$descriptionContent = $descriptionContent -replace '\n', "`n "
96+
$descriptionContent = $descriptionContent -replace '# Description\r\n ', '.DESCRIPTION'
97+
$descriptionContent = $descriptionContent -replace '\r\n\s{4}\r\n', "`n`n"
98+
$descriptionContent = $descriptionContent -replace '\s{4}$', ''
9499

95100
$output += $descriptionContent
96101
$output += [Environment]::NewLine
@@ -150,8 +155,10 @@ function New-DscResourcePowerShellHelp
150155
{
151156
$savePath = Join-Path -Path $mofFileObject.DirectoryName -ChildPath 'en-US' | Join-Path -ChildPath $outputFileName
152157
}
158+
153159
Write-Verbose -Message ($script:localizedData.OutputHelpDocumentMessage -f $savePath)
154-
$output | Out-File -FilePath $savePath -Encoding utf8 -Force
160+
161+
$output | Out-File -FilePath $savePath -Encoding ascii -Force
155162
}
156163
else
157164
{

0 commit comments

Comments
 (0)