Skip to content

Commit 3de1085

Browse files
Merge pull request #110 from PowershellFrameworkCollective/development
2.2.7.90
2 parents 4527543 + 1943097 commit 3de1085

File tree

68 files changed

+873
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+873
-479
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ sh.exe.stackdump
2525

2626
# ignore the TestResults
2727
TestResults/*
28+
29+
# ignore the build & publishing Directories
30+
publish/*
31+
Templates_Build/*

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
RootModule = 'PSModuleDevelopment.psm1'
55

66
# Version number of this module.
7-
ModuleVersion = '2.2.6.72'
7+
ModuleVersion = '2.2.7.90'
88

99
# ID used to uniquely identify this module
1010
GUID = '37dd5fce-e7b5-4d57-ac37-832055ce49d6'
@@ -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
@@ -65,19 +65,20 @@
6565
# Functions to export from this module
6666
FunctionsToExport = @(
6767
'Expand-PSMDTypeName',
68+
'Export-PSMDString',
6869
'Find-PSMDFileContent',
6970
'Find-PSMDType',
7071
'Format-PSMDParameter',
7172
'Get-PSMDArgumentCompleter',
7273
'Get-PSMDAssembly',
7374
'Get-PSMDConstructor',
74-
'Get-PSMDHelpEx',
75+
'Get-PSMDHelp',
7576
'Get-PSMDMember',
7677
'Get-PSMDModuleDebug',
7778
'Get-PSMDTemplate',
7879
'Import-PSMDModuleDebug',
7980
'Invoke-PSMDTemplate',
80-
'Measure-PSMDCommandEx',
81+
'Measure-PSMDCommand',
8182
'Measure-PSMDLinesOfCode',
8283
'New-PSMDDotNetProject',
8384
'New-PSMDHeader',
@@ -135,7 +136,7 @@
135136
Tags = @('Development', 'Module')
136137

137138
# A URL to the license for this module.
138-
# LicenseUri = ''
139+
LicenseUri = 'https://github.com/PowershellFrameworkCollective/PSModuleDevelopment/blob/development/LICENSE'
139140

140141
# A URL to the main website for this project.
141142
ProjectUri = 'http://psframework.org'
Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
$script:PSModuleRoot = $PSScriptRoot
2-
$script:PSModuleVersion = (Import-PowerShellDataFile -Path "$($script:PSModuleRoot)\PSModuleDevelopment.psd1").ModuleVersion
1+
$script:ModuleRoot = $PSScriptRoot
2+
$script:ModuleVersion = (Import-PowerShellDataFile -Path "$($script:ModuleRoot)\PSModuleDevelopment.psd1").ModuleVersion
33

4-
$script:doDotSource = $false
5-
if (Get-PSFConfigValue -FullName PSModuleDevelopment.Import.DoDotSource) { $script:doDotSource = $true }
4+
# Detect whether at some level dotsourcing was enforced
5+
$script:doDotSource = Get-PSFConfigValue -FullName PSModuleDevelopment.Import.DoDotSource -Fallback $false
6+
if ($PSModuleDevelopment_dotsourcemodule) { $script:doDotSource = $true }
67

7-
#region Helper function
8-
function Import-PSMDFile
8+
<#
9+
Note on Resolve-Path:
10+
All paths are sent through Resolve-Path/Resolve-PSFPath in order to convert them to the correct path separator.
11+
This allows ignoring path separators throughout the import sequence, which could otherwise cause trouble depending on OS.
12+
Resolve-Path can only be used for paths that already exist, Resolve-PSFPath can accept that the last leaf my not exist.
13+
This is important when testing for paths.
14+
#>
15+
16+
# Detect whether at some level loading individual module files, rather than the compiled module was enforced
17+
$importIndividualFiles = Get-PSFConfigValue -FullName PSModuleDevelopment.Import.IndividualFiles -Fallback $false
18+
if ($PSModuleDevelopment_importIndividualFiles) { $importIndividualFiles = $true }
19+
if (Test-Path (Resolve-PSFPath -Path "$($script:ModuleRoot)\..\.git" -SingleItem -NewChild)) { $importIndividualFiles = $true }
20+
if ("<was not compiled>" -eq '<was not compiled>') { $importIndividualFiles = $true }
21+
22+
function Import-ModuleFile
923
{
1024
<#
1125
.SYNOPSIS
@@ -14,44 +28,54 @@ function Import-PSMDFile
1428
.DESCRIPTION
1529
This helper function is used during module initialization.
1630
It should always be dotsourced itself, in order to proper function.
31+
32+
This provides a central location to react to files being imported, if later desired
1733
1834
.PARAMETER Path
1935
The path to the file to load
2036
2137
.EXAMPLE
22-
PS C:\> . Import-PSMDFile -File $function.FullName
38+
PS C:\> . Import-ModuleFile -File $function.FullName
2339
2440
Imports the file stored in $function according to import policy
2541
#>
2642
[CmdletBinding()]
27-
Param (
43+
param (
2844
[string]
2945
$Path
3046
)
3147

3248
$resolvedPath = $ExecutionContext.SessionState.Path.GetResolvedPSPathFromPSPath($Path).ProviderPath
33-
if ($script:doDotSource) { . $resolvedPath }
49+
if ($doDotSource) { . $resolvedPath }
3450
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($resolvedPath))), $null, $null) }
3551
}
36-
#endregion Helper function
37-
3852

39-
# Perform Actions before loading the rest of the content
40-
. Import-PSMDFile -Path "$PSModuleRoot\internal\scripts\preload.ps1"
41-
42-
#region Load internal functions
43-
foreach ($function in (Get-ChildItem "$PSModuleRoot\internal\functions" -Recurse -File -Filter "*.ps1"))
53+
#region Load individual files
54+
if ($importIndividualFiles)
4455
{
45-
. Import-PSMDFile -Path $function.FullName
46-
}
47-
#endregion Load internal functions
48-
49-
#region Load functions
50-
foreach ($function in (Get-ChildItem "$PSModuleRoot\functions" -Recurse -File -Filter "*.ps1"))
51-
{
52-
. Import-PSMDFile -Path $function.FullName
56+
# Execute Preimport actions
57+
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\preimport.ps1"
58+
59+
# Import all internal functions
60+
foreach ($function in (Get-ChildItem "$ModuleRoot\internal\functions" -Filter "*.ps1" -Recurse -ErrorAction Ignore))
61+
{
62+
. Import-ModuleFile -Path $function.FullName
63+
}
64+
65+
# Import all public functions
66+
foreach ($function in (Get-ChildItem "$ModuleRoot\functions" -Filter "*.ps1" -Recurse -ErrorAction Ignore))
67+
{
68+
. Import-ModuleFile -Path $function.FullName
69+
}
70+
71+
# Execute Postimport actions
72+
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\postimport.ps1"
73+
74+
# End it here, do not load compiled code below
75+
return
5376
}
54-
#endregion Load functions
77+
#endregion Load individual files
5578

56-
# Perform Actions after loading the module contents
57-
. Import-PSMDFile -Path "$PSModuleRoot\internal\scripts\postload.ps1"
79+
#region Load compiled code
80+
"<compile code into here>"
81+
#endregion Load compiled code

PSModuleDevelopment/changelog.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
# Changelog
2+
## 2.2.7.90 (September 1st, 2019)
3+
- New: Export-PSMDString - Parses strings from modules using the PSFramework localization feature.
4+
- Upd: Measure-PSMDCommand - Renamed from Measure-PSMDCommandEx, performance upgrades, adding option for comparing multiple test sets.
5+
- Upd: Refactored and updated the ModuleDebug component
6+
- Upd: Renamed Get-PSMDHelpEx to Get-PSMDHelp
7+
- Upd: Template PSFProject - Adding `-IncludAZ` switch parameter to `vsts-packageFunction.ps1`, making the template include the AZ module as managed dependency.
8+
- Upd: Template PSFProject - yaml file for AzDev PR validation pipeline
9+
- Upd: Refactored module structure to comply with current Fred Reference Architecture
10+
- Upd: Template PSFTests - Added localization string tests
11+
- Upd: Remove-PSMDTemplate - Refactored and updated messaging / ShouldProcess implementation
12+
- Upd: Find-PSMDFileContent - Updated extension filtering to be configurable and include .cs files by default.
13+
- Upd: Get-PSMDArgumentCompleter - Refactoring and minor performance improvement
14+
- Upd: Restart-PSMDShell - Will restart same application as current process, enabling it to restart on core versions
15+
- Fix: Template PSFProject - Publish Folder created during build is created using `-Force`
16+
- Fix: Template PSFProject - Cleaning up Azure Function conversion
17+
- Fix: Template PSFTests - Encoding test no longer fails on core (#104)
18+
- Fix: Template PSFTests - Referenced DLLs from GAC will fail as path cannot be found (#100)
19+
- Fix: Template Module - RootModule | 3-element version | Module Import from UNC path
20+
- Fix: Template-System - Bad default template store path on linux or mac. (#106)
21+
222
## 2.2.6.72 (May 27th, 2019)
323
- New: Template AzureFunction - Creates a basic azure function scaffold
424
- New: Template AzureFunctionTimer - Creates a timer triggered Azure Function
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/assembly/Find-PSMDType.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,4 @@
127127
}
128128
}
129129
}
130-
end
131-
{
132-
133-
}
134130
}

PSModuleDevelopment/functions/assembly/Get-PSMDAssembly.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@
2727
$Filter = "*"
2828
)
2929

30-
[appdomain]::CurrentDomain.GetAssemblies() | Where-Object FullName -Like $Filter
30+
process
31+
{
32+
[appdomain]::CurrentDomain.GetAssemblies() | Where-Object FullName -Like $Filter
33+
}
3134
}

PSModuleDevelopment/functions/help/Get-PSMDHelpEx.ps1 renamed to PSModuleDevelopment/functions/help/Get-PSMDHelp.ps1

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Function Get-PSMDHelpEx
1+
Function Get-PSMDHelp
22
{
33
<#
44
.SYNOPSIS
55
Displays localized information about Windows PowerShell commands and concepts.
66
77
.DESCRIPTION
8-
The Get-PSMDHelpEx function is a wrapper around get-help that allows localizing help queries.
8+
The Get-PSMDHelp function is a wrapper around get-help that allows localizing help queries.
99
This is especially useful when developing modules with help in multiple languages.
1010
1111
.PARAMETER Category
@@ -110,7 +110,7 @@
110110
This parameter is introduced in Windows PowerShell 3.0.
111111
112112
.EXAMPLE
113-
PS C:\> Get-PSMDHelpEx Get-Help "en-us" -Detailed
113+
PS C:\> Get-PSMDHelp Get-Help "en-us" -Detailed
114114
115115
Gets the detailed help text of Get-Help in English
116116
@@ -188,9 +188,7 @@
188188
}
189189

190190
# Prepare Splat for splatting a steppable pipeline
191-
$splat = $PSBoundParameters
192-
if ($splat.ContainsKey("Language")) { $null = $splat.Remove("Language") }
193-
if ($splat.ContainsKey("SetLanguage")) { $null = $splat.Remove("SetLanguage") }
191+
$splat = $PSBoundParameters | ConvertTo-PSFHashtable -Exclude Language, SetLanguage
194192

195193
try
196194
{
@@ -212,4 +210,4 @@
212210
catch { throw }
213211
}
214212
}
215-
New-Alias -Name hex -Value Get-PSMDHelpEx -Scope Global -Option AllScope
213+
New-Alias -Name hex -Value Get-PSMDHelp -Scope Global -Option AllScope

PSModuleDevelopment/functions/moduledebug/Get-PSMDModuleDebug.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
PS C:\> Get-PSMDModuleDebug -Filter *net*
1616
1717
Returns the module debugging configuration for all modules with a name that contains "net"
18-
19-
.NOTES
20-
Version 1.1.0.0
21-
Author: Friedrich Weinmann
22-
Created on: August 7th, 2016
2318
#>
2419
[CmdletBinding()]
2520
Param (
2621
[string]
2722
$Filter = "*"
2823
)
2924

30-
Import-Clixml $PSModuleDevelopment_ModuleConfigPath | Where-Object { ($_.Name -like $Filter) -and ($_.Name.Length -gt 0) }
25+
process
26+
{
27+
Import-Clixml -Path (Get-PSFConfigValue -FullName 'PSModuleDevelopment.Debug.ConfigPath') | Where-Object {
28+
($_.Name -like $Filter) -and ($_.Name.Length -gt 0)
29+
}
30+
}
3131
}

PSModuleDevelopment/functions/moduledebug/Import-PSMDModuleDebug.ps1

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,31 @@
1414
PS C:\> Import-PSMDModuleDebug -Name 'cPSNetwork'
1515
1616
Imports the cPSNetwork module as it was configured to be imported using Set-ModuleDebug.
17-
18-
.NOTES
19-
Version 1.0.0.0
20-
Author: Friedrich Weinmann
21-
Created on: August 7th, 2016
2217
#>
2318
[CmdletBinding()]
24-
Param (
19+
param (
2520
[string]
2621
$Name
2722
)
2823

29-
# Get original module configuration
30-
$____module = $null
31-
$____module = Import-Clixml $PSModuleDevelopment_ModuleConfigPath | Where-Object { $_.Name -eq $Name }
32-
if (-not $____module) { throw "No matching module configuration found" }
33-
34-
# Process entry
35-
if ($____module.DebugMode) { Set-Variable -Scope Global -Name "$($____module.Name)_DebugMode" -Value $____module.DebugMode -Force }
36-
if ($____module.PreImportAction)
24+
process
3725
{
38-
[System.Management.Automation.ScriptBlock]::Create($____module.PreImportAction).Invoke()
39-
}
40-
Import-Module -Name $____module.Name
41-
if ($____module.PostImportAction)
42-
{
43-
[System.Management.Automation.ScriptBlock]::Create($____module.PostImportAction).Invoke()
26+
# Get original module configuration
27+
$____module = $null
28+
$____module = Import-Clixml -Path (Get-PSFConfigValue -FullName 'PSModuleDevelopment.Debug.ConfigPath') | Where-Object { $_.Name -eq $Name }
29+
if (-not $____module) { throw "No matching module configuration found" }
30+
31+
# Process entry
32+
if ($____module.DebugMode) { Set-Variable -Scope Global -Name "$($____module.Name)_DebugMode" -Value $____module.DebugMode -Force }
33+
if ($____module.PreImportAction)
34+
{
35+
[System.Management.Automation.ScriptBlock]::Create($____module.PreImportAction).Invoke()
36+
}
37+
Import-Module -Name $____module.Name -Scope Global
38+
if ($____module.PostImportAction)
39+
{
40+
[System.Management.Automation.ScriptBlock]::Create($____module.PostImportAction).Invoke()
41+
}
4442
}
4543
}
4644
New-Alias -Name ipmod -Value Import-ModuleDebug -Option AllScope -Scope Global

0 commit comments

Comments
 (0)