Skip to content

Commit 589ccbd

Browse files
authored
New Task - Package_Wiki_Content (#144)
1 parent bb39323 commit 589ccbd

11 files changed

+217
-2
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
### Added
9+
10+
- Task `Package_Wiki_Content` - This task will compress generated documentation
11+
into a .zip archive.
12+
13+
### Changed
14+
15+
- Skipped failing tests on Linux due to libmi.
16+
817
## [0.12.1] - 2024-01-21
918

1019
### Fixed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,32 @@ DscResource.DocGenerator:
420420
Publish_GitHub_Wiki_Content:
421421
Debug: true
422422
```
423+
424+
### `Package_Wiki_Content`
425+
426+
This build task runs the command `Compress-Archive`.
427+
428+
Below is an example how the build task can be used when a repository is
429+
based on the [Sampler](https://github.com/gaelcolas/Sampler) project.
430+
431+
>**NOTE:** This task is meant to be run after the task `Generate_Wiki_Content`
432+
>that is normally run in the docs phase. But this task can be used to upload
433+
>any content to a Wiki.
434+
435+
```yaml
436+
BuildWorkflow:
437+
'.':
438+
- build
439+
440+
build:
441+
- Clean
442+
- Build_Module_ModuleBuilder
443+
- Build_NestedModules_ModuleBuilder
444+
- Create_changelog_release_output
445+
446+
docs:
447+
- Generate_Conceptual_Help
448+
- Generate_Wiki_Content
449+
- Package_Wiki_Content
450+
451+
```

source/DscResource.DocGenerator.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
AliasesToExport = @(
5656
'Task.Generate_Conceptual_Help',
5757
'Task.Generate_Wiki_Content',
58+
'Task.Package_Wiki_Content',
5859
'Task.Publish_GitHub_Wiki_Content'
5960
)
6061

@@ -85,4 +86,3 @@
8586
} # End of PSData hashtable
8687
} # End of PrivateData hashtable
8788
}
88-
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<#
2+
.SYNOPSIS
3+
This is the alias to the build task Package_Wiki_Content's script file.
4+
5+
.DESCRIPTION
6+
This makes available the alias 'Task.Package_Wiki_Content' that is
7+
exported in the module manifest so that the build task can be correctly
8+
imported using for example Invoke-Build.
9+
10+
.NOTES
11+
This is using the pattern lined out in the Invoke-Build repository
12+
https://github.com/nightroman/Invoke-Build/tree/master/Tasks/Import.
13+
#>
14+
15+
Set-Alias -Name 'Task.Package_Wiki_Content' -Value "$PSScriptRoot/tasks/Package_Wiki_Content.build.ps1"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<#
2+
.SYNOPSIS
3+
This is a build task that generates conceptual help.
4+
5+
.PARAMETER OutputDirectory
6+
The base directory of all output. Defaults to folder 'output' relative to
7+
the $BuildRoot.
8+
9+
.PARAMETER ProjectName
10+
The project name. Defaults to the Project Name.
11+
12+
.PARAMETER BuildInfo
13+
The build info object from ModuleBuilder. Defaults to an empty hashtable.
14+
15+
.NOTES
16+
This is a build task that is primarily meant to be run by Invoke-Build but
17+
wrapped by the Sampler project's build.ps1 (https://github.com/gaelcolas/Sampler).
18+
#>
19+
20+
param
21+
(
22+
[Parameter()]
23+
[System.String]
24+
$OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')),
25+
26+
[Parameter()]
27+
[System.String]
28+
$ProjectName = (property ProjectName $(Get-SamplerProjectName -BuildRoot $BuildRoot)),
29+
30+
[Parameter()]
31+
[System.Collections.Hashtable]
32+
$BuildInfo = (property BuildInfo @{ })
33+
)
34+
35+
# Synopsis: Package wiki documentation for the DSC resources.
36+
task Package_Wiki_Content {
37+
# Get the values for task variables, see https://github.com/gaelcolas/Sampler#task-variables.
38+
. Set-SamplerTaskVariable
39+
40+
"`tProject Name = {0}" -f $ProjectName
41+
"`tOutput Directory = {0}" -f $OutputDirectory
42+
43+
$wikiOutputPath = Join-Path -Path $OutputDirectory -ChildPath 'WikiContent'
44+
$wikiArchiveSourcePath = Join-Path -Path $wikiOutputPath -ChildPath '*'
45+
$wikiPackagePath = Join-Path -Path $OutputDirectory -ChildPath 'WikiContent.zip'
46+
47+
"`tWiki Output Path = $wikiOutputPath"
48+
"`tWiki Archive Source Path = $wikiArchiveSourcePath"
49+
"`tWiki Package Path = $wikiPackagePath"
50+
51+
if (-not (Test-Path -Path $wikiOutputPath))
52+
{
53+
throw 'The Wiki Output Path does not exist. Please run the task Generate_Wiki_Content prior to running this task.'
54+
}
55+
56+
Write-Build Magenta 'Packaging Wiki content.'
57+
58+
# Overwrites any existing archive.
59+
Compress-Archive -Path $wikiArchiveSourcePath -DestinationPath $wikiPackagePath -CompressionLevel 'Optimal' -Force -ErrorAction 'Stop'
60+
}

tests/unit/private/Get-CompositeResourceParameterState.Tests.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ $script:moduleName = Get-Module -Name $script:projectName -ListAvailable | Selec
1616
Remove-Module -Name $script:moduleName -Force -ErrorAction 'SilentlyContinue'
1717

1818
Import-Module $script:moduleName -Force -ErrorAction 'Stop'
19+
20+
if ($IsLinux) {
21+
return
22+
}
1923
#endregion HEADER
2024

2125
InModuleScope $script:moduleName {
22-
Describe 'Get-CompositeResourceParameterState' {
26+
Describe 'Get-CompositeResourceParameterState'{
2327
BeforeAll {
2428
$script:tokens, $script:parseErrors = $null
2529

tests/unit/private/Get-CompositeResourceParameterValidateSet.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ $script:moduleName = Get-Module -Name $script:projectName -ListAvailable | Selec
1616
Remove-Module -Name $script:moduleName -Force -ErrorAction 'SilentlyContinue'
1717

1818
Import-Module $script:moduleName -Force -ErrorAction 'Stop'
19+
20+
if ($IsLinux) {
21+
return
22+
}
1923
#endregion HEADER
2024

2125
InModuleScope $script:moduleName {

tests/unit/private/Get-CompositeSchemaObject.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ $script:moduleName = Get-Module -Name $script:projectName -ListAvailable | Selec
1616
Remove-Module -Name $script:moduleName -Force -ErrorAction 'SilentlyContinue'
1717

1818
Import-Module $script:moduleName -Force -ErrorAction 'Stop'
19+
20+
if ($IsLinux) {
21+
return
22+
}
1923
#endregion HEADER
2024

2125
InModuleScope $script:moduleName {

tests/unit/private/Get-ConfigurationAst.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ $script:moduleName = Get-Module -Name $script:projectName -ListAvailable | Selec
1616
Remove-Module -Name $script:moduleName -Force -ErrorAction 'SilentlyContinue'
1717

1818
Import-Module $script:moduleName -Force -ErrorAction 'Stop'
19+
20+
if ($IsLinux) {
21+
return
22+
}
1923
#endregion HEADER
2024

2125
InModuleScope $script:moduleName {

tests/unit/private/Get-MofSchemaObject.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ $script:moduleName = Get-Module -Name $script:projectName -ListAvailable | Selec
1616
Remove-Module -Name $script:moduleName -Force -ErrorAction 'SilentlyContinue'
1717

1818
Import-Module $script:moduleName -Force -ErrorAction 'Stop'
19+
20+
if ($IsLinux) {
21+
return
22+
}
1923
#endregion HEADER
2024

2125
InModuleScope $script:moduleName {

0 commit comments

Comments
 (0)