Skip to content

Commit 148ad95

Browse files
Merge pull request #194 from PowershellFrameworkCollective/development
2.2.11.163
2 parents 6a79d23 + 6b613cf commit 148ad95

Some content is hidden

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

52 files changed

+1094
-94
lines changed

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Version number of this module.
77

8-
ModuleVersion = '2.2.11.146'
8+
ModuleVersion = '2.2.11.163'
99

1010
# ID used to uniquely identify this module
1111
GUID = '37dd5fce-e7b5-4d57-ac37-832055ce49d6'

PSModuleDevelopment/changelog.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 2.2.11.163 (2024-02-25)
4+
5+
+ New: Template ApplockerPipeline - A project that can be used to generate AppLocker policies across environments
6+
+ Upd: Template AzureFunction - Added automatic Endpoint generation based on functions defined in the module
7+
+ Upd: Template PSFProject - Improved PSScriptAnalyzer test results
8+
+ Upd: Template PSFProject - Extended list of blacklisted commands
9+
+ Upd: Template PSFProject - Build logic now also supports compiling the C# solution
10+
+ Upd: Template PSFModule - Improved PSScriptAnalyzer test results
11+
+ Upd: Template PSFModule - Extended list of blacklisted commands
12+
+ Upd: Template PSFHelp - Improved PSScriptAnalyzer test results
13+
+ Upd: Template PSFHelp - Extended list of blacklisted commands
14+
+ Upd: Template MiniModule - Extended list of blacklisted commands
15+
+ Fix: Template PSFProject - Help test fails on PS7.4
16+
+ Fix: Template PSFProject - Help test added ProgressAction to common parameters
17+
+ Fix: Template PSFModule - Help test fails on PS7.4
18+
+ Fix: Template PSFModule - Help test added ProgressAction to common parameters
19+
+ Fix: Template PSFHelp - Help test fails on PS7.4
20+
+ Fix: Template PSFHelp - Help test added ProgressAction to common parameters
21+
+ Fix: Template MiniModule - Help test - added ProgressAction to common parameters
22+
323
## 2.2.11.146 (2023-05-31)
424

525
+ Upd: Export-PSMDString - added support for Get-PSMDLocalizedString calls (#181, thanks @nyanhp)

PSModuleDevelopment/functions/templating/Invoke-PSMDTemplate.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
PS C:\> Invoke-PSMDTemplate -TemplateName "module" -Name "MyModule"
8383
8484
Creates a project based on the module template with the name "MyModule"
85+
86+
.EXAMPLE
87+
PS C:\> Invoke-PSMDTemplate MiniModule -Parameters @{ Author = 'Fred' }
88+
89+
Creates a new project based on the template MiniModule and predefines the value for the "Author" placeholder.
8590
#>
8691
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSPossibleIncorrectUsageOfAssignmentOperator", "")]
8792
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '')]

PSModuleDevelopment/tests/general/Help.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ foreach ($command in $commands) {
8787

8888
Context "Test parameter help for $commandName" {
8989

90-
$common = 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable'
90+
$common = 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable', 'ProgressAction'
9191

9292
$parameters = $command.ParameterSets.Parameters | Sort-Object -Property Name -Unique | Where-Object Name -notin $common
9393
$parameterNames = $parameters.Name

PSModuleDevelopment/tests/general/PSScriptAnalyzer.Tests.ps1

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,49 @@
22
Param (
33
[switch]
44
$SkipTest,
5-
5+
66
[string[]]
77
$CommandPath = @("$global:testroot\..\functions", "$global:testroot\..\internal\functions")
88
)
99

10-
if ($SkipTest) { return }
10+
BeforeDiscovery {
11+
if ($SkipTest) { return }
12+
13+
$global:__pester_data.ScriptAnalyzer = New-Object System.Collections.ArrayList
14+
15+
# Create an array containing the path and basename of all files to test
16+
$commandFiles = $CommandPath | ForEach-Object {
17+
Get-ChildItem -Path $_ -Recurse | Where-Object Name -like "*.ps1"
18+
} | ForEach-Object {
19+
@{
20+
BaseName = $_.BaseName
21+
FullName = $_.FullName
22+
}
23+
}
1124

12-
$global:__pester_data.ScriptAnalyzer = New-Object System.Collections.ArrayList
25+
# Create an array contain all rules
26+
$scriptAnalyzerRules = Get-ScriptAnalyzerRule | ForEach-Object {
27+
@{
28+
RuleName = $_.RuleName
29+
}
30+
}
31+
}
1332

1433
Describe 'Invoking PSScriptAnalyzer against commandbase' {
15-
$commandFiles = Get-ChildItem -Path $CommandPath -Recurse | Where-Object Name -like "*.ps1"
16-
$scriptAnalyzerRules = Get-ScriptAnalyzerRule
17-
18-
foreach ($file in $commandFiles)
19-
{
20-
Context "Analyzing $($file.BaseName)" {
21-
$analysis = Invoke-ScriptAnalyzer -Path $file.FullName -ExcludeRule PSAvoidTrailingWhitespace, PSShouldProcess
22-
23-
forEach ($rule in $scriptAnalyzerRules)
24-
{
25-
It "Should pass $rule" -TestCases @{ analysis = $analysis; rule = $rule } {
26-
If ($analysis.RuleName -contains $rule)
27-
{
28-
$analysis | Where-Object RuleName -EQ $rule -outvariable failures | ForEach-Object { $null = $global:__pester_data.ScriptAnalyzer.Add($_) }
29-
30-
1 | Should -Be 0
31-
}
32-
else
33-
{
34-
0 | Should -Be 0
35-
}
36-
}
37-
}
34+
35+
Context "Analyzing <BaseName>" -ForEach $commandFiles {
36+
BeforeAll {
37+
$analysis = Invoke-ScriptAnalyzer -Path $FullName -ExcludeRule PSAvoidTrailingWhitespace, PSShouldProcess
38+
}
39+
40+
It "Should pass <RuleName>" -Foreach $scriptAnalyzerRules {
41+
# Test if the rule is present and if so create a string containing more info which will be shown in the details of the test output. If it's empty the test is succesfull as there is no problem with this rule.
42+
$analysis | Where-Object RuleName -EQ $RuleName | Foreach-Object {
43+
# Create a string
44+
"$($_.Severity) at Line $($_.Line) Column $($_.Column) with '$($_.Extent)'"
45+
# Add the data (and supress the output) to the global variable for later use
46+
$null = $global:__pester_data.ScriptAnalyzer.Add($_)
47+
} | Should -BeNullOrEmpty
3848
}
3949
}
4050
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
publish:
9+
10+
runs-on: windows-latest
11+
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: Install Prerequisites
15+
run: .\build\prerequisites.ps1 -BuildWorker -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1)
16+
shell: powershell
17+
- name: Validate Configuration Data
18+
run: .\build\validate.ps1 -TestType ConfigurationData -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -ProjectRoot $env:GITHUB_WORKSPACE
19+
shell: powershell
20+
- name: Build
21+
run: .\build\build.ps1 -IncludeRsop -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -SourcePath (Join-Path $env:GITHUB_WORKSPACE configurationdata) -OutputPath (Join-Path $env:GITHUB_WORKSPACE output)
22+
shell: powershell
23+
- uses: actions/upload-artifact@v3
24+
with:
25+
name: build-artifacts
26+
path: |
27+
.\output\rsop
28+
.\output\policies
29+
- name: Publish
30+
run: .\build\publish.ps1
31+
shell: powershell
32+
- name: Validate Integration Tests
33+
run: .\build\validate.ps1 -TestType Integration -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -ProjectRoot $env:GITHUB_WORKSPACE
34+
shell: powershell
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
on: [pull_request]
2+
3+
jobs:
4+
validate:
5+
6+
runs-on: windows-latest
7+
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: Install Prerequisites
11+
run: .\build\prerequisites.ps1 -BuildWorker -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1)
12+
shell: powershell
13+
- name: Validate Configuration Data
14+
run: .\build\validate.ps1 -TestType ConfigurationData -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -ProjectRoot $env:GITHUB_WORKSPACE
15+
shell: powershell
16+
- name: Build
17+
run: .\build\build.ps1 -IncludeRsop -DependencyPath (Join-Path $env:GITHUB_WORKSPACE build\requiredModules.psd1) -SourcePath (Join-Path $env:GITHUB_WORKSPACE configurationdata) -OutputPath (Join-Path $env:GITHUB_WORKSPACE output)
18+
shell: powershell
19+
- uses: actions/upload-artifact@v3
20+
with:
21+
name: build-artifacts
22+
path: |
23+
.\output\rsop
24+
.\output\policies

templates/AppLockerProject/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
output
2+
testresults.xml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
param (
2+
$Path
3+
)
4+
5+
New-PSMDTemplate -ReferencePath "$PSScriptRoot" -OutPath $Path

0 commit comments

Comments
 (0)