Skip to content

Commit 77db3da

Browse files
author
Friedrich Weinmann
committed
Bugfixes and added templates
1 parent fbb76de commit 77db3da

19 files changed

Lines changed: 244 additions & 2 deletions

‎PSModuleDevelopment/PSModuleDevelopment.psm1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$script:PSModuleVersion = "2.2.0.11"
33

44
$script:doDotSource = $false
5-
if (Get-PSFConfigValue -Name PSModuleDevelopment.Import.DoDotSource) { $script:doDotSource = $true }
5+
if (Get-PSFConfigValue -FullName PSModuleDevelopment.Import.DoDotSource) { $script:doDotSource = $true }
66

77
#region Helper function
88
function Import-PSMDFile

‎PSModuleDevelopment/functions/templating/New-PSMDTemplate.ps1‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,18 @@
229229
}
230230
#endregion Insert basic meta-data
231231

232+
#region Validation
233+
#region Validate FilePath
234+
if ($FilePath)
235+
{
236+
if (-not (Test-Path $FilePath -PathType Leaf))
237+
{
238+
Stop-PSFFunction -Message "Filepath $FilePath is invalid. Ensure it exists and is a file" -EnableException $EnableException -Category InvalidArgument -Tag 'fail', 'argument', 'path'
239+
return
240+
}
241+
}
242+
#endregion Validate FilePath
243+
232244
#region Validate & ensure output folder
233245
$fileName = "$($template.Name)-$($template.Version).xml"
234246
$infoFileName = "$($template.Name)-$($template.Version)-Info.xml"
@@ -265,6 +277,7 @@
265277
return
266278
}
267279
#endregion Validate & ensure output folder
280+
#endregion Validation
268281

269282
#region Utility functions
270283
function Convert-Item
@@ -428,7 +441,7 @@
428441
#region Fixed string replacement
429442
if ($find.Groups[1].Success)
430443
{
431-
if ($object.FileSystemParameterFlat -notcontains $find.Groups[1].Value)
444+
if ($object.ContentParameterFlat -notcontains $find.Groups[1].Value)
432445
{
433446
$null = $object.ContentParameterFlat.Add($find.Groups[1].Value)
434447
}
@@ -522,6 +535,7 @@
522535
foreach ($item in (Get-ChildItem -Path $processedReferencePath -Filter $Filter))
523536
{
524537
if ($item.FullName -in $Exclusions) { continue }
538+
if ($item.Name -eq "PSMDTemplate.ps1") { continue }
525539
Convert-Item -Item $item -Filter $Filter -Exclusions $Exclusions -Template $template -ReferencePath $processedReferencePath -Identifier $identifier -BinaryExtensions $binaryExtensions
526540
}
527541
}
Binary file not shown.
Binary file not shown.
5.51 KB
Binary file not shown.
18.9 KB
Binary file not shown.
5.68 KB
Binary file not shown.
98.6 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
New-PSMDTemplate -FilePath "$PSScriptRoot\PSMDTemplate.ps1" -TemplateName PSMDTemplateReference -OutStore psmoduledevelopment -Description "PSModule Development Template Reference file" -Author "Friedrich Weinmann" -Tags 'template','file','configuration'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@{
2+
TemplateName = 'þnameþ' # Insert name of template
3+
Version = "1.0.0.0" # Version to build to
4+
AutoIncrementVersion = $true # If a newer version than specified is present, instead of the specified version, make it one greater than the existing template
5+
Tags = @() # Insert Tags as desired
6+
Author = 'þauthorþ' # The author of the template, not the file / project created from it
7+
Description = 'þdescriptionþ' # Try describing the template
8+
Exclusions = @() # Contains list of files - relative path to root - to ignore when building the template
9+
Scripts = @{
10+
guid = {
11+
[System.Guid]::NewGuid().ToString()
12+
}
13+
} # Insert additional scriptblocks as needed. Each scriptblock will be executed once only on create, no matter how often it is referenced.
14+
}

0 commit comments

Comments
 (0)