Skip to content

Commit 25acc5d

Browse files
upgrades
1 parent ff16c67 commit 25acc5d

File tree

12 files changed

+20
-50
lines changed

12 files changed

+20
-50
lines changed

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# Modules that must be imported into the global environment prior to importing
4343
# this module
4444
RequiredModules = @(
45-
@{ ModuleName = 'PSFramework'; ModuleVersion = '1.0.19' }
45+
@{ ModuleName = 'PSFramework'; ModuleVersion = '1.0.35' }
4646
)
4747

4848
# Assemblies that must be loaded prior to importing this module

PSModuleDevelopment/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- Upd: Template PSFProject - Adding `-IncludAZ` switch parameter to `vsts-packageFunction.ps1`, making the template include the AZ module as managed dependency.
88
- Upd: Refactored module structure to comply with current Fred Reference Architecture
99
- Upd: Template PSFTests - Added localization string tests
10+
- Upd: Remove-PSMDTemplate - Refactored and updated messaging / ShouldProcess implementation
11+
- Upd: Find-PSMDFileContent - Updated extension filtering to be configurable and include .cs files by default.
1012
- Fix: Template PSFProject - Publish Folder created during build is created using `-Force`
1113
- Fix: Template PSFProject - Cleaning up Azure Function conversion
1214
- Fix: Template PSFTests - Encoding test no longer fails on core (#104)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
@{
22
'MeasurePSMDLinesOfCode.Processing' = 'Processing Path: {0}'
3+
'Remove-PSMDTemplate.Removing.Template' = 'Removing template {0} (v{1}) from store {2}'
34
}

PSModuleDevelopment/functions/refactor/Set-PSMDEncoding.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
$EnableException
4848
)
4949

50-
begin
51-
{
52-
Write-PSFMessage -Level InternalComment -Message "Bound parameters: $($PSBoundParameters.Keys -join ", ")" -Tag 'debug', 'start', 'param'
53-
}
5450
process
5551
{
5652
foreach ($pathItem in $Path)

PSModuleDevelopment/functions/templating/Invoke-PSMDTemplate.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
$NoFolder,
113113

114114
[hashtable]
115-
$Parameters,
115+
$Parameters = @{ },
116116

117117
[switch]
118118
$Raw,
@@ -129,8 +129,6 @@
129129

130130
begin
131131
{
132-
Write-PSFMessage -Level InternalComment -Message "Bound parameters: $($PSBoundParameters.Keys -join ", ")" -Tag 'debug', 'start', 'param'
133-
134132
#region Validate output path
135133
try
136134
{

PSModuleDevelopment/functions/templating/New-PSMDDotNetProject.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,6 @@
174174
& dotnet.exe new $dotNetArgs
175175
}
176176
}
177-
end
178-
{
179-
180-
}
181177
}
182178

183179
New-Alias -Name dotnetnew -Value New-PSMDDotNetProject -Option AllScope -Scope Global -ErrorAction Ignore

PSModuleDevelopment/functions/templating/New-PSMDTemplate.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@
154154

155155
begin
156156
{
157-
Write-PSFMessage -Level InternalComment -Message "Bound parameters: $($PSBoundParameters.Keys -join ", ")" -Tag 'debug', 'start', 'param'
158157
#region Insert basic meta-data
159158
$identifier = [regex]::Escape(( Get-PSFConfigValue -FullName 'psmoduledevelopment.template.identifier' -Fallback 'þ' ))
160159
$binaryExtensions = Get-PSFConfigValue -FullName 'PSModuleDevelopment.Template.BinaryExtensions' -Fallback @('.dll', '.exe', '.pdf', '.doc', '.docx', '.xls', '.xlsx')

PSModuleDevelopment/functions/templating/Remove-PSMDTemplate.ps1

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878

7979
begin
8080
{
81-
Write-PSFMessage -Level InternalComment -Message "Bound parameters: $($PSBoundParameters.Keys -join ", ")" -Tag 'debug', 'start', 'param'
82-
8381
$templates = @()
8482
switch ($PSCmdlet.ParameterSetName)
8583
{
@@ -139,23 +137,15 @@
139137
{
140138
foreach ($item in $Template)
141139
{
142-
if ($PSCmdlet.ShouldProcess($item, "Remove template"))
143-
{
144-
try { Remove-Template -Template $item }
145-
catch { Stop-PSFFunction -Message "Failed to remove template $($item)" -EnableException $EnableException -ErrorRecord $_ -Target $item -Tag 'fail', 'template', 'remove' -Continue }
146-
}
140+
Invoke-PSFProtectedCommand -ActionString 'Remove-PSMDTemplate.Removing.Template' -Target $item.Name -ScriptBlock {
141+
Remove-Template -Template $item
142+
} -EnableException $EnableException.ToBool() -PSCmdlet $PSCmdlet -Continue -ActionStringValues $item.Name, $item.Version, $item.Store
147143
}
148144
foreach ($item in $templates)
149145
{
150-
if ($PSCmdlet.ShouldProcess($item, "Remove template"))
151-
{
152-
try { Remove-Template -Template $item }
153-
catch { Stop-PSFFunction -Message "Failed to remove template $($item)" -EnableException $EnableException -ErrorRecord $_ -Target $item -Tag 'fail', 'template', 'remove' -Continue }
154-
}
146+
Invoke-PSFProtectedCommand -ActionString 'Remove-PSMDTemplate.Removing.Template' -Target $item.Name -ScriptBlock {
147+
Remove-Template -Template $item
148+
} -EnableException $EnableException.ToBool() -PSCmdlet $PSCmdlet -Continue -ActionStringValues $item.Name, $item.Version, $item.Store
155149
}
156150
}
157-
end
158-
{
159-
160-
}
161151
}

PSModuleDevelopment/functions/utility/Find-PSMDFileContent.ps1

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
[string]
3838
$Pattern,
3939

40-
[string[]]
41-
$Extension = @(".ps1", ".psd1", ".psm1"),
40+
[string]
41+
$Extension = (Get-PSFConfigValue -FullName 'PSModuleDevelopment.Find.DefaultExtensions'),
4242

4343
[string]
4444
$Path = (Get-PSFConfigValue -FullName 'PSModuleDevelopment.Module.Path'),
@@ -59,11 +59,7 @@
5959
{
6060
if (Test-PSFFunctionInterrupt) { return }
6161

62-
Get-ChildItem -Path $Path -Recurse | Where-Object Extension -In $Extension | Select-String -Pattern $Pattern
63-
}
64-
end
65-
{
66-
if (Test-PSFFunctionInterrupt) { return }
62+
Get-ChildItem -Path $Path -Recurse | Where-Object Extension -Match $Extension | Select-String -Pattern $Pattern
6763
}
6864
}
6965
New-Alias -Name find -Value Find-PSMDFileContent -Scope Global -Option AllScope

PSModuleDevelopment/functions/utility/Get-PSMDArgumentCompleter.ps1

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,8 @@
3232

3333
begin
3434
{
35-
$internalExecutionContext = [PSFramework.Utility.UtilityHost]::GetExecutionContextFromTLS()
36-
$customArgumentCompletersProperty = $internalExecutionContext.GetType().GetProperty(
37-
'CustomArgumentCompleters',
38-
[System.Reflection.BindingFlags]'NonPublic, Instance'
39-
)
40-
$customArgumentCompleters = $customArgumentCompletersProperty.GetGetMethod($true).Invoke(
41-
$internalExecutionContext,
42-
[System.Reflection.BindingFlags]'Instance, NonPublic, GetProperty',
43-
$null,
44-
@(),
45-
$psculture
46-
)
35+
$internalExecutionContext = [PSFramework.Utility.UtilityHost]::GetExecutionContextFromTLS()
36+
$customArgumentCompleters = [PSFramework.Utility.UtilityHost]::GetPrivateProperty('CustomArgumentCompleters', $internalExecutionContext)
4737
}
4838
process
4939
{
@@ -55,7 +45,7 @@
5545
{
5646
if ($parameter -like $ParameterName)
5747
{
58-
New-Object PSObject -Property @{
48+
[pscustomobject]@{
5949
CommandName = $name
6050
ParameterName = $parameter
6151
Definition = $customArgumentCompleters[$argumentCompleter]

0 commit comments

Comments
 (0)