Skip to content

Commit 545dc66

Browse files
committed
0.2.3 Release
1 parent 610a422 commit 545dc66

File tree

203 files changed

+28626
-229
lines changed

Some content is hidden

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

203 files changed

+28626
-229
lines changed

ModuleBuild.build.ps1

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
param (
22
[parameter(Position = 0)]
3-
[string]$BuildFile = (Join-Path $BuildRoot 'build\ModuleBuild.buildenvironment.ps1'),
3+
[string]$BuildFile = @(Get-ChildItem 'build\*.buildenvironment.ps1')[0].FullName,
44
[parameter(Position = 1)]
55
[version]$NewVersion = $null,
66
[parameter(Position = 2)]
@@ -9,8 +9,8 @@ param (
99
[switch]$Force
1010
)
1111

12-
# Basic indented descriptive build output.
1312
Function Write-Description {
13+
# Basic indented descriptive build output.
1414
param (
1515
[string]$color = 'White',
1616
[string]$Description = '',
@@ -33,7 +33,7 @@ if (Test-Path $BuildFile) {
3333
. $BuildFile
3434
}
3535
else {
36-
throw "Without a build environment file we are at a loss as to what to qdo!"
36+
throw "Without a build environment file we are at a loss as to what to do!"
3737
}
3838

3939
if ($Script:BuildEnv.OptionTranscriptEnabled) {
@@ -61,10 +61,13 @@ task LoadRequiredModules {
6161
if ($Script:BuildEnv.OptionAnalyzeCode) {
6262
$Script:RequiredModules += 'PSScriptAnalyzer'
6363
}
64-
6564
if ($Script:BuildEnv.OptionGenerateReadTheDocs) {
6665
$Script:RequiredModules += 'Powershell-YAML'
6766
}
67+
if ($Script:BuildEnv.OptionCodeHealthReport) {
68+
$RequiredModules += 'PSCodeHealth'
69+
}
70+
6871
$Script:RequiredModules | Foreach-Object {
6972
if ((get-module $_ -ListAvailable) -eq $null) {
7073
Write-Description White "Installing $($_) Module" -Level 2
@@ -769,12 +772,12 @@ task AutoIncreaseVersionBuildLevel -after PublishPSGallery -if {$Script:BuildEnv
769772
}
770773

771774
# Synopsis: Install the current built module to the local machine
772-
task InstallModule VersionCheck, {
775+
task InstallModule VersionCheck, LoadBuildTools, {
773776
Write-Description White "Attempting to install the current module" -accent
774777
$CurrentModulePath = Join-Path $Script:BuildEnv.BaseReleaseFolder $Script:BuildEnv.ModuleVersion
775778
assert (Test-Path $CurrentModulePath) 'The current version module has not been built yet!'
776779

777-
$MyModulePath = "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules\"
780+
$MyModulePath = "$((Get-SpecialPaths)['MyDocuments'])\WindowsPowerShell\Modules\"
778781
$ModuleInstallPath = "$($MyModulePath)$($Script:BuildEnv.ModuleToBuild)"
779782
if (Test-Path $ModuleInstallPath) {
780783
Write-Description White "Removing installed module $($Script:BuildEnv.ModuleToBuild)" -Level 2
@@ -830,7 +833,7 @@ task PostBuildTasks {
830833
}
831834

832835
# Synopsis: Remove session artifacts like loaded modules and variables
833-
task BuildSessionCleanup {
836+
task BuildSessionCleanup LoadRequiredModules, {
834837
Write-Description White 'Cleaning up the build session' -accent
835838

836839
$BuildToolPath = Join-Path $BuildRoot $Script:BuildEnv.BuildToolFolder

build/ModuleBuild.buildenvironment.ps1

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,4 @@ if ((Get-Variable 'BuildEnv' -ErrorAction:SilentlyContinue) -eq $null) {
119119
Write-Verbose "Exporting the BuildEnv data!"
120120
$Script:BuildEnv | ConvertTo-Json | Out-File -FilePath $PersistentBuildFile -Encoding $Script:BuildEnv.Encoding -Force
121121
}
122-
123-
$RequiredModules = @('PlatyPS', 'Pester')
124-
125-
# Some optional modules
126-
if ($Script:BuildEnv.OptionAnalyzeCode) {
127-
$RequiredModules += 'PSScriptAnalyzer'
128-
}
129-
130-
if ($Script:BuildEnv.OptionGenerateReadTheDocs) {
131-
$RequiredModules += 'Powershell-YAML'
132-
}
133-
134-
if ($Script:BuildEnv.OptionCodeHealthReport) {
135-
$RequiredModules += 'PSCodeHealth'
136-
}
137-
138-
}
122+
}

build/docs/Additional/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Project Site: [https://github.com/zloeber/ModuleBuild](https://github.com/zloeber/ModuleBuild)
44

5+
## Version 0.2.3
6+
- Eliminated any customization requirements within the modulename.build.ps1 script to help pave the way for easier modulebuild upgrades to projects.
7+
- Removed some superfluous code in the base build environment script around the RequiredModules variable.
58
## Version 0.2.2
69
- Updated vscode tasks.json to fix depreciated syntax.
710
- Fixed `-Force` switch processing on Add-PublicFunction to still create the function if the provided name is detected as plural.

build/docs/Additional/ToDo.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ There are many items which are possible and should probably be added to this pro
1313
- Automatic clean up of additional loaded modules when uploading to the gallery
1414
- Powershell Core compatibility
1515
- Automatic updates of the ReleaseNotes.md file
16-
- Appveyor integration
16+
- Appveyor integration?
17+
- PSDeploy integration?
18+
- Github releases integration?
19+
- Smoother path to upgrade ModuleBuild for existing projects
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Function Script:Get-SpecialPaths {
2+
$SpecialFolders = @{}
3+
4+
$names = [Environment+SpecialFolder]::GetNames([Environment+SpecialFolder])
5+
6+
foreach ($name in $names) {
7+
$SpecialFolders[$name] = [Environment]::GetFolderPath($name)
8+
}
9+
10+
$SpecialFolders
11+
}

buildreports/CodeHealthReport-Private.html

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ <h1>
189189
<div class="col-sm-4 col-md-5 col-lg-4 right-header">
190190
<h5>
191191
Analyzed path :<span class="right-header-data"> src\private</span><br>
192-
Analysis date :<span class="right-header-data"> 2018-02-04 22:23:40Z</span>
192+
Analysis date :<span class="right-header-data"> 2018-03-19 07:47:09Z</span>
193193
</h5>
194194
</div>
195195
</div>
@@ -391,16 +391,16 @@ <h2 class="panel-title"> Per Function Information</h2>
391391
<td class="warning cell-largeContent">ScriptName : Get-BuildFilePath.ps1<br>
392392
Line (in the function) : 2<br>
393393
Severity : Warning<br>
394-
RuleName : PSAvoidUsingCmdletAliases<br>
395-
Message : 'select' is an alias of 'Select-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.<br>
394+
RuleName : PSUseDeclaredVarsMoreThanAssignments<br>
395+
Message : The variable 'BuildPath' is assigned but never used.<br>
396396
</td>
397397
</tr>
398398
<tr>
399399
<td class="warning cell-largeContent">ScriptName : Get-BuildFilePath.ps1<br>
400400
Line (in the function) : 2<br>
401401
Severity : Warning<br>
402-
RuleName : PSUseDeclaredVarsMoreThanAssignments<br>
403-
Message : The variable 'BuildPath' is assigned but never used.<br>
402+
RuleName : PSAvoidUsingCmdletAliases<br>
403+
Message : 'select' is an alias of 'Select-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.<br>
404404
</td>
405405
</tr>
406406
</table>
@@ -453,14 +453,6 @@ <h2 class="panel-title"> Per Function Information</h2>
453453
<table>
454454
<tr>
455455
<td class="warning cell-largeContent">ScriptName : Get-FunctionParameter.ps1<br>
456-
Line (in the function) : 105<br>
457-
Severity : Warning<br>
458-
RuleName : PSPossibleIncorrectComparisonWithNull<br>
459-
Message : $null should be on the left side of equality comparisons.<br>
460-
</td>
461-
</tr>
462-
<tr>
463-
<td class="warning cell-largeContent">ScriptName : Get-FunctionParameter.ps1<br>
464456
Line (in the function) : 54<br>
465457
Severity : Warning<br>
466458
RuleName : PSUseDeclaredVarsMoreThanAssignments<br>
@@ -477,6 +469,14 @@ <h2 class="panel-title"> Per Function Information</h2>
477469
</tr>
478470
<tr>
479471
<td class="warning cell-largeContent">ScriptName : Get-FunctionParameter.ps1<br>
472+
Line (in the function) : 105<br>
473+
Severity : Warning<br>
474+
RuleName : PSPossibleIncorrectComparisonWithNull<br>
475+
Message : $null should be on the left side of equality comparisons.<br>
476+
</td>
477+
</tr>
478+
<tr>
479+
<td class="warning cell-largeContent">ScriptName : Get-FunctionParameter.ps1<br>
480480
Line (in the function) : 81<br>
481481
Severity : Warning<br>
482482
RuleName : PSAvoidUsingCmdletAliases<br>
@@ -511,14 +511,6 @@ <h2 class="panel-title"> Per Function Information</h2>
511511
<table>
512512
<tr>
513513
<td class="warning cell-largeContent">ScriptName : Get-ParentASTTypes.ps1<br>
514-
Line (in the function) : 50<br>
515-
Severity : Information<br>
516-
RuleName : PSUseOutputTypeCorrectly<br>
517-
Message : The cmdlet 'Get-ParentASTTypes' returns an object of type 'System.Object[]' but this type is not declared in the OutputType attribute.<br>
518-
</td>
519-
</tr>
520-
<tr>
521-
<td class="warning cell-largeContent">ScriptName : Get-ParentASTTypes.ps1<br>
522514
Line (in the function) : 1<br>
523515
Severity : Warning<br>
524516
RuleName : PSUseSingularNouns<br>
@@ -527,6 +519,14 @@ <h2 class="panel-title"> Per Function Information</h2>
527519
</tr>
528520
<tr>
529521
<td class="warning cell-largeContent">ScriptName : Get-ParentASTTypes.ps1<br>
522+
Line (in the function) : 50<br>
523+
Severity : Information<br>
524+
RuleName : PSUseOutputTypeCorrectly<br>
525+
Message : The cmdlet 'Get-ParentASTTypes' returns an object of type 'System.Object[]' but this type is not declared in the OutputType attribute.<br>
526+
</td>
527+
</tr>
528+
<tr>
529+
<td class="warning cell-largeContent">ScriptName : Get-ParentASTTypes.ps1<br>
530530
Line (in the function) : 32<br>
531531
Severity : Warning<br>
532532
RuleName : PSPossibleIncorrectComparisonWithNull<br>

buildreports/CodeHealthReport-Public.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ <h1>
189189
<div class="col-sm-4 col-md-5 col-lg-4 right-header">
190190
<h5>
191191
Analyzed path :<span class="right-header-data"> src\public</span><br>
192-
Analysis date :<span class="right-header-data"> 2018-02-04 22:23:32Z</span>
192+
Analysis date :<span class="right-header-data"> 2018-03-19 07:47:00Z</span>
193193
</h5>
194194
</div>
195195
</div>
@@ -517,18 +517,18 @@ <h2 class="panel-title"> Per Function Information</h2>
517517
<table>
518518
<tr>
519519
<td class="warning cell-largeContent">ScriptName : Set-BuildEnvironment.ps1<br>
520-
Line (in the function) : 1<br>
520+
Line (in the function) : 51<br>
521521
Severity : Warning<br>
522-
RuleName : PSUseShouldProcessForStateChangingFunctions<br>
523-
Message : Function ’Set-BuildEnvironment’ has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.<br>
522+
RuleName : PSAvoidUsingEmptyCatchBlock<br>
523+
Message : Empty catch block is used. Please use Write-Error or throw statements in catch blocks.<br>
524524
</td>
525525
</tr>
526526
<tr>
527527
<td class="warning cell-largeContent">ScriptName : Set-BuildEnvironment.ps1<br>
528-
Line (in the function) : 51<br>
528+
Line (in the function) : 1<br>
529529
Severity : Warning<br>
530-
RuleName : PSAvoidUsingEmptyCatchBlock<br>
531-
Message : Empty catch block is used. Please use Write-Error or throw statements in catch blocks.<br>
530+
RuleName : PSUseShouldProcessForStateChangingFunctions<br>
531+
Message : Function ’Set-BuildEnvironment’ has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.<br>
532532
</td>
533533
</tr>
534534
<tr>

docs/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Project Site: [https://github.com/zloeber/ModuleBuild](https://github.com/zloeber/ModuleBuild)
44

5+
## Version 0.2.3
6+
- Eliminated any customization requirements within the modulename.build.ps1 script to help pave the way for easier modulebuild upgrades to projects.
7+
- Removed some superfluous code in the base build environment script around the RequiredModules variable.
58
## Version 0.2.2
69
- Updated vscode tasks.json to fix depreciated syntax.
710
- Fixed `-Force` switch processing on Add-PublicFunction to still create the function if the provided name is detected as plural.

docs/Functions/Add-PublicFunction.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ Adds a public function to your modulebuild based project based on defined templa
1313
## SYNTAX
1414

1515
```
16-
Add-PublicFunction [[-Name] <String>] [-Force] [-TemplateName <String>]
16+
Add-PublicFunction [[-Name] <String>] [-Force] [-TemplateName <String>] [<CommonParameters>]
1717
```
1818

1919
## DESCRIPTION
2020
Adds a public function to your modulebuild based project.
2121

2222
## EXAMPLES
2323

24-
### -------------------------- EXAMPLE 1 --------------------------
24+
### EXAMPLE 1
2525
```
2626
Add-PublicFunction -Name 'New-AwesomeFunction' -TemplateName:PlainPublicFunction
2727
```
@@ -35,7 +35,7 @@ Must use a valid PowerShell verb-action format and be singular.
3535
```yaml
3636
Type: String
3737
Parameter Sets: (All)
38-
Aliases:
38+
Aliases:
3939

4040
Required: False
4141
Position: 1
@@ -50,7 +50,7 @@ Ignore function name best practices warnings.
5050
```yaml
5151
Type: SwitchParameter
5252
Parameter Sets: (All)
53-
Aliases:
53+
Aliases:
5454

5555
Required: False
5656
Position: Named
@@ -65,7 +65,7 @@ Use this template file for the new function
6565
```yaml
6666
Type: String
6767
Parameter Sets: (All)
68-
Aliases:
68+
Aliases:
6969

7070
Required: False
7171
Position: Named
@@ -74,6 +74,10 @@ Accept pipeline input: False
7474
Accept wildcard characters: False
7575
```
7676
77+
### CommonParameters
78+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
79+
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
80+
7781
## INPUTS
7882
7983
## OUTPUTS

docs/Functions/Get-BuildEnvironment.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ Retrieves all the stored settings in a buildenvironment.json file.
1313
## SYNTAX
1414

1515
```
16-
Get-BuildEnvironment [[-Path] <String>]
16+
Get-BuildEnvironment [[-Path] <String>] [<CommonParameters>]
1717
```
1818

1919
## DESCRIPTION
2020
Retrieves all the stored settings in a buildenvironment.json file.
2121

2222
## EXAMPLES
2323

24-
### -------------------------- EXAMPLE 1 --------------------------
24+
### EXAMPLE 1
2525
```
2626
Get-buildenvironment
2727
```
@@ -37,7 +37,7 @@ Specifies the path to a buildenvironment.json file.
3737
```yaml
3838
Type: String
3939
Parameter Sets: (All)
40-
Aliases:
40+
Aliases:
4141

4242
Required: False
4343
Position: 1
@@ -46,6 +46,10 @@ Accept pipeline input: True (ByValue)
4646
Accept wildcard characters: False
4747
```
4848
49+
### CommonParameters
50+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
51+
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
52+
4953
## INPUTS
5054
5155
## OUTPUTS

0 commit comments

Comments
 (0)