Skip to content

Commit b03ce93

Browse files
more pathing fixes
1 parent 0e83742 commit b03ce93

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

PSModuleDevelopment/functions/templating/Get-PSMDTemplate.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@
9191
#region Scan folders
9292
if (Test-PSFParameterBinding -ParameterName "Path")
9393
{
94-
$templateInfos = Get-ChildItem -Path $Path -Filter "$($TemplateName)-*.Info.xml" | Where-Object { ($_.Name -replace "-\d+(\.\d+){0,3}.Info.xml$") -like $TemplateName }
94+
$templateInfos = Get-ChildItem -Path $Path -Filter "$($TemplateName)-*-Info.xml" | Where-Object { ($_.Name -replace "-\d+(\.\d+){0,3}-Info.xml$") -like $TemplateName }
9595

9696
foreach ($info in $templateInfos)
9797
{
9898
$data = Import-PSFClixml $info.FullName
99-
$data.Path = $info.FullName -replace '\.Info\.xml$','.xml'
99+
$data.Path = $info.FullName -replace '-Info\.xml$','.xml'
100100
$prospects += $data
101101
}
102102
}

PSModuleDevelopment/tests/functions/Templates.Tests.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
Describe "Verifying templating component" {
22
BeforeAll {
3+
$outPath = (Get-Item -Path 'TestDrive:\').FullName
34
$resourcePath = Resolve-PSFPath -Path "$PSScriptRoot\..\resources"
45
$templateName = 'TestTemplate-{0}' -f (Get-Random)
56
}
67

78
It "Should Record the template correctly" {
8-
{ New-PSMDTemplate -TemplateName $templateName -FilePath "$resourcePath\þnameþ.txt" -EnableException -ErrorAction Stop } | Should -Not -Throw
9-
$templateInfo = Get-PSMDTemplate -TemplateName $templateName
9+
{ New-PSMDTemplate -TemplateName $templateName -FilePath "$resourcePath\þnameþ.txt" -OutPath $outPath -EnableException -ErrorAction Stop } | Should -Not -Throw
10+
$templateInfo = Get-PSMDTemplate -TemplateName $templateName -Path $outPath
1011
$templateRaw = Import-PSFClixml -Path $templateInfo.Path
1112
$template = [PSModuleDevelopment.Template.Template]$templateRaw
1213
$template.Name | Should -Be $templateName
@@ -16,7 +17,7 @@
1617
}
1718

1819
It "Should Invoke the template correctly" {
19-
{ Invoke-PSMDTemplate -TemplateName $templateName -OutPath TestDrive:\ -Name Test -EnableException } | Should -Not -Throw
20+
{ Invoke-PSMDTemplate -TemplateName $templateName -Path $outPath -OutPath $outPath -Name Test -EnableException } | Should -Not -Throw
2021
$content = Get-Content -Path "TestDrive:\Test.txt" -ErrorAction Stop
2122
$values = $content | ConvertFrom-StringData -ErrorAction Stop
2223
$values.Name | Should -Be Test

0 commit comments

Comments
 (0)