diff --git a/CHANGELOG.md b/CHANGELOG.md index 054437f..66ef356 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ * [PSProfile - ChangeLog](#psprofile---changelog) + * [0.1.8 - 2019-08-26](#018---2019-08-26) * [0.1.7 - 2019-08-25](#017---2019-08-25) * [0.1.6 - 2019-08-24](#016---2019-08-24) * [0.1.5 - 2019-08-22](#015---2019-08-22) @@ -12,6 +13,10 @@ # PSProfile - ChangeLog +## 0.1.8 - 2019-08-26 + +* Fixed issue with `$PSProfile.ModulesToImport` where an empty string was added to the array, resulting in a Warning during profile load about the module failing to import. + ## 0.1.7 - 2019-08-25 * Fixed `Task` parameter type on `Start-BuildScript` to allow an array of strings. diff --git a/PSProfile/Classes/PSProfile.Classes.ps1 b/PSProfile/Classes/PSProfile.Classes.ps1 index a138099..2363934 100644 --- a/PSProfile/Classes/PSProfile.Classes.ps1 +++ b/PSProfile/Classes/PSProfile.Classes.ps1 @@ -314,16 +314,16 @@ class PSProfile { "Debug" ) $final = @{ } - $Global:PSProfile.Prompts.GetEnumerator() | ForEach-Object { + $this.Prompts.GetEnumerator() | ForEach-Object { $this._log( - "Formatting prompt '$($_.Key)' via Trim()", + "Formatting prompt '$($_.Key)'", "FormatPrompts", "Verbose" ) $updated = ($_.Value -split "[\r\n]" | Where-Object { $_ }).Trim() -join "`n" $final[$_.Key] = $updated } - $Global:PSProfile.Prompts = $final + $this.Prompts = $final $this._log( "SECTION END", "FormatPrompts", @@ -642,7 +642,7 @@ class PSProfile { 'Debug' ) if (-not [string]::IsNullOrEmpty((-join $this.ModulesToInstall))) { - $null = $this.ModulesToInstall | Start-RSJob -Name { "_PSProfile_InstallModule_$($_)" } -VariablesToImport this -ScriptBlock { + $null = $this.ModulesToInstall | Where-Object {-not [string]::IsNullOrEmpty($_)} | Start-RSJob -Name { "_PSProfile_InstallModule_$($_)" } -VariablesToImport this -ScriptBlock { Param ( [parameter()] [object] @@ -699,7 +699,7 @@ class PSProfile { 'Debug' ) if (-not [string]::IsNullOrEmpty((-join $this.ModulesToImport))) { - $this.ModulesToImport | ForEach-Object { + $this.ModulesToImport | Where-Object {-not [string]::IsNullOrEmpty($_)} | ForEach-Object { try { $params = if ($_ -is [string]) { @{Name = $_ }