Skip to content

Commit 04ce853

Browse files
authored
Fix class resource generation (#163)
1 parent 10f93b3 commit 04ce853

21 files changed

+1219
-567
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Removed
99

1010
- Removed `build.psd1` as it is no longer required to build the project.
11+
- Removed ClassAst functions
12+
- `Get-ClassResourceProperty`
13+
- `Get-ClassAst`
14+
- `Get-ClassResourceAst`
1115

1216
### Added
1317

@@ -25,6 +29,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2529
filename. The task will convert standard hyphens to spaces and Unicode
2630
hyphens to standard hyphens before comparison. The task can be controlled
2731
by parameter `RemoveTopLevelHeader` in the task, which defaults to `$true`.
32+
- Added Helper functions as part of [#163] (https://github.com/dsccommunity/DscResource.DocGenerator/pull/163).
33+
- `Get-ClassPropertyCustomAttribute`
34+
- `Get-DscResourceAttributeProperty`
35+
- `Get-DscPropertyType`
36+
- `Test-ClassPropertyDscAttributeArgument`
2837

2938
### Changed
3039

@@ -42,6 +51,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4251
- Task `Generate_Markdown_For_DSC_Resources`
4352
- Outputs a warning message if the old configuration key is used in the
4453
build configuration but keeps using the old configuration key.
54+
- `New-DscClassResourcePage`
55+
- Remove using Ast to generate documentation. Fixes [#116](https://github.com/dsccommunity/DscResource.DocGenerator/issues/116).
56+
- Order properties correctly fixes [#126](https://github.com/dsccommunity/DscResource.DocGenerator/issues/126).
4557

4658
### Fixed
4759

build.yaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Prefix: ./prefix.ps1
1515
####################################################
1616

1717
NestedModule:
18-
DscResource.Common:
19-
CopyOnly: true
20-
Path: ./output/RequiredModules/DscResource.Common
21-
AddToManifest: false
22-
Exclude: PSGetModuleInfo.xml
18+
DscResource.Common:
19+
CopyOnly: true
20+
Path: ./output/RequiredModules/DscResource.Common
21+
AddToManifest: false
22+
Exclude: PSGetModuleInfo.xml
2323

2424
####################################################
2525
# Sampler Pipeline Configuration #
@@ -35,16 +35,17 @@ BuildWorkflow:
3535
- Build_Module_ModuleBuilder
3636
- Build_NestedModules_ModuleBuilder
3737
- Create_changelog_release_output
38+
39+
docs:
3840
- Generate_Conceptual_Help
3941
- Generate_Wiki_Content
40-
- Generate_Markdown_For_Public_Commands
41-
- Generate_External_Help_File_For_Public_Commands
4242
- Generate_Wiki_Sidebar
43-
- Clean_Markdown_Of_Public_Commands
4443
- Clean_Markdown_Metadata
44+
- Package_Wiki_Content
4545

4646
pack:
4747
- build
48+
- docs
4849
- package_module_nupkg
4950

5051
hqrmtest:
@@ -68,8 +69,6 @@ BuildWorkflow:
6869
Remove-Module -Name 'DscResource.DocGenerator' -ErrorAction SilentlyContinue
6970
}
7071
71-
72-
7372
####################################################
7473
# PESTER Configuration #
7574
####################################################
@@ -138,7 +137,7 @@ DscResource.DocGenerator:
138137
- '\*(.+?)\*' # Match Italic (asterisk)
139138
Publish_GitHub_Wiki_Content:
140139
Debug: true
141-
Generate_Wiki_Content:
140+
Generate_Markdown_For_DSC_Resources:
142141
MofResourceMetadata:
143142
Type: MofResource
144143
Category: Resources
@@ -149,5 +148,5 @@ DscResource.DocGenerator:
149148
Type: CompositeResource
150149
Category: Resources
151150
Generate_Wiki_Sidebar:
152-
Debug: false
153-
AlwaysOverwrite: true
151+
Debug: false
152+
AlwaysOverwrite: true

source/Private/Get-ClassAst.ps1

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<#
2+
.SYNOPSIS
3+
This function returns a filtered list of CustomAttributes from a given AttributeType.
4+
5+
.DESCRIPTION
6+
The function will filter the provided CustomAttributes provided and returns only the matching attributes or null.
7+
8+
.PARAMETER Attributes
9+
The array of attributes that need to be filtered.
10+
11+
.PARAMETER AttributeType
12+
The attribute type name to filter the attributes on.
13+
14+
.OUTPUTS
15+
System.Reflection.CustomAttributeData[]
16+
17+
.EXAMPLE
18+
Get-ClassPropertyCustomAttribute -Attributes $CommonAttributes -AttributeType 'ValidateSetAttribute'
19+
#>
20+
21+
function Get-ClassPropertyCustomAttribute
22+
{
23+
[CmdletBinding()]
24+
[OutputType([System.Reflection.CustomAttributeData[]])]
25+
param (
26+
[Parameter(Mandatory = $true)]
27+
[System.Reflection.CustomAttributeData[]]
28+
$Attributes,
29+
30+
[Parameter(Mandatory = $true)]
31+
[System.String]
32+
$AttributeType
33+
)
34+
35+
process
36+
{
37+
return $Attributes | Where-Object { $_.AttributeType.Name -eq $AttributeType }
38+
}
39+
}

source/Private/Get-ClassResourceAst.ps1

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)