forked from MicrosoftDocs/PowerShell-Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.ps1
51 lines (42 loc) · 2.03 KB
/
appveyor.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
param(
[switch]$SkipCabs,
[switch]$ShowProgress
)
# Turning off the progress display, by default
$global:ProgressPreference = 'SilentlyContinue'
if($ShowProgress){$ProgressPreference = 'Continue'}
# Find the reference folder path w.r.t the script
$ReferenceDocset = Join-Path $PSScriptRoot 'reference'
# Variable to collect any errors in during processing
$allErrors = @()
# Go through all the directories in the reference folder
Get-ChildItem $ReferenceDocset -Directory | ForEach-Object -Process {
$Version = $_.Name
$VersionFolder = $_.FullName
# For each of the directories, go through each module folder
Get-ChildItem $VersionFolder -Directory | ForEach-Object -Process {
$ModuleName = $_
$ModulePath = Join-Path $VersionFolder $_
$LandingPage = Join-Path $ModulePath "$ModuleName.md"
$MamlOutputFolder = Join-Path "$PSScriptRoot\maml" "$Version\$ModuleName"
$CabOutputFolder = Join-Path "$PSScriptRoot\updatablehelp" "$Version\$ModuleName"
try {
# For each module, create a single maml help file
# Adding warningaction=stop to throw errors for all warnings, erroraction=stop to make them terminating errors
New-ExternalHelp -Path $ModulePath -OutputPath $MamlOutputFolder -Force -WarningAction Stop -ErrorAction Stop
# For each module, create update-help help files (cab and helpinfo.xml files)
if (-not $SkipCabs) {
$cabInfo = New-ExternalHelpCab -CabFilesFolder $MamlOutputFolder -LandingPagePath $LandingPage -OutputFolder $CabOutputFolder
# Only output the cab fileinfo object
if($cabInfo.Count -eq 8){$cabInfo[-1].FullName}
}
} catch {
$allErrors += $_
}
}
}
# If the above block, produced any errors, throw and fail the job
if ($allErrors) {
$allErrors
throw "There are errors during platyPS run!`nPlease fix your markdown to comply with the schema: https://github.com/PowerShell/platyPS/blob/master/platyPS.schema.md"
}