8000 task UpdateCBH: Bug fixed in updating Comment Based Help in functions to point to external help by schittli · Pull Request #10 · ModuleBuild/ModuleBuild · GitHub
[go: up one dir, main page]

Skip to content

task UpdateCBH: Bug fixed in updating Comment Based Help in functions to point to external help #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions ModuleBuild.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ param (
)

Function Write-Description {
# Basic indented descriptive build output.
param (
# Basic indented descriptive build output. $Description can contain Newlines.
Param (
[string]$color = 'White',
[string]$Description = '',
[int]$Level = 0,
Expand All @@ -22,11 +22,12 @@ Function Write-Description {
)

$thisindent = (' ' * $indent) * $level
if ($accent) {
If ($accent) {
$accentleft = $AccentL
$accentright = $AccentR
}
Write-Build $color "$accentleft$thisindent$Description$accentright"

$Description -split '\r\n|\n' | ForEach-Object { Write-Build $color "$accentleft$thisindent$($_)$accentright" }
}

if (Test-Path $BuildFile) {
Expand Down Expand Up @@ -445,14 +446,14 @@ task UpdateCBH {
"@

$ScratchPath = Join-Path $BuildRoot $Script:BuildEnv.ScratchFolder
$CBHPattern = "(?ms)(\<#.*\.SYNOPSIS.*?#>)"
[Regex]$CBHPattern = '(?ms)\<\#(\#(?!\>)|[^#])*\#\>'
Get-ChildItem -Path "$($ScratchPath)\$($Script:BuildEnv.PublicFunctionSource)\*.ps1" -File | ForEach-Object {
$FormattedOutFile = $_.FullName
$FileName = $_.Name
Write-Description White "Replacing CBH in file: $($FileName)" -level 2
$FunctionName = $FileName -replace '.ps1', ''
$NewExternalHelp = $ExternalHelp -replace '{{LINK}}', ($Script:BuildEnv.ModuleWebsite + "/tree/master/$($Script:BuildEnv.BaseReleaseFolder)/$($Script:BuildEnv.ModuleVersion)/docs/Functions/$($FunctionName).md")
$UpdatedFile = (get-content $FormattedOutFile -raw) -replace $CBHPattern, $NewExternalHelp
$UpdatedFile = $CBHPattern.Replace( (Get-Content $FormattedOutFile -raw), $NewExternalHelp, 1)
$UpdatedFile | Out-File -FilePath $FormattedOutFile -force -Encoding $Script:BuildEnv.Encoding
}
}
Expand Down
9 changes: 5 additions & 4 deletions plaster/ModuleBuild/scaffold/modulename.build.template
Original file line number Diff line number Diff line change
8000 Expand Up @@ -9,9 +9,9 @@
[switch]$Force
)

# Basic indented descriptive build output.
Function Write-Description {
param (
# Basic indented descriptive build output. $Description can contain Newlines.
Param (
[string]$color = 'White',
[string]$Description = '',
[int]$Level = 0,
Expand All @@ -22,11 +22,12 @@ Function Write-Description {
)

$thisindent = (' ' * $indent) * $level
if ($accent) {
If ($accent) {
$accentleft = $AccentL
$accentright = $AccentR
}
Write-Build $color "$accentleft$thisindent$Description$accentright"

$Description -split '\r\n|\n' | ForEach-Object { Write-Build $color "$accentleft$thisindent$($_)$accentright" }
}

if (Test-Path $BuildFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
[switch]$Force
)

# Basic indented descriptive build output.
Function Write-Description {
param (
# Basic indented descriptive build output. $Description can contain Newlines.
Param (
[string]$color = 'White',
[string]$Description = '',
[int]$Level = 0,
Expand All @@ -22,11 +22,12 @@ Function Write-Description {
)

$thisindent = (' ' * $indent) * $level
if ($accent) {
If ($accent) {
$accentleft = $AccentL
$accentright = $AccentR
}
Write-Build $color "$accentleft$thisindent$Description$accentright"

$Description -split '\r\n|\n' | ForEach-Object { Write-Build $color "$accentleft$thisindent$($_)$accentright" }
}

if (Test-Path $BuildFile) {
Expand Down
0