Skip to content

Commit 5bd7ef8

Browse files
authored
Get-ClassResourceProperty - Check for prefixed and non-prefixed class names (#152)
1 parent c37ad91 commit 5bd7ef8

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
- `Get-ClassResourceProperty`
9+
- Check for a prefixed and non-prefixed class names [issue #132](https://github.com/dsccommunity/DscResource.DocGenerator/issues/132).
10+
- `azure-pipelines`
11+
- Pin gitversion to V5.
12+
813
## [0.12.4] - 2024-06-03
914

1015
### Fixed

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ stages:
2727
vmImage: 'ubuntu-latest'
2828
steps:
2929
- pwsh: |
30-
dotnet tool install --global GitVersion.Tool
30+
dotnet tool install --global GitVersion.Tool --version 5.*
3131
$gitVersionObject = dotnet-gitversion | ConvertFrom-Json
3232
$gitVersionObject.PSObject.Properties.ForEach{
3333
Write-Host -Object "Setting Task Variable '$($_.Name)' with value '$($_.Value)'."

source/Private/Get-ClassResourceProperty.ps1

+19-3
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,29 @@ function Get-ClassResourceProperty
4444
{
4545
$dscResourceAst = Get-ClassAst -ClassName $currentClassName -ScriptFile $BuiltModuleScriptFilePath
4646

47-
$sourceFilePath = Join-Path -Path $SourcePath -ChildPath ('Classes/???.{0}.ps1' -f $currentClassName)
47+
$classExists = $false
48+
$sourceFilePath = ''
49+
$childPaths = @(
50+
('Classes/???.{0}.ps1' -f $currentClassName)
51+
('Classes/{0}.ps1' -f $currentClassName)
52+
)
53+
54+
foreach ($childPath in $childPaths)
55+
{
56+
$sourceFilePath = Join-Path -Path $SourcePath -ChildPath $childPath
57+
58+
if ((Test-Path -Path $sourceFilePath))
59+
{
60+
$classExists = $true
61+
break
62+
}
63+
}
4864

4965
<#
50-
Skip if the class's source file does not exist. Thi can happen if the
66+
Skip if the class's source file does not exist. This can happen if the
5167
class uses a parent class from a different module.
5268
#>
53-
if (-not (Test-Path -Path $sourceFilePath))
69+
if (-not $classExists)
5470
{
5571
continue
5672
}

0 commit comments

Comments
 (0)