Skip to content

Commit d340408

Browse files
authored
!deploy v0.4.1 release (#19)
## 0.4.1 - 2019-10-08 * Miscellaneous * Added `LastSave` property to the primary `PSProfile` class * Added check on `Save()` method to pull in updated configuration if it has been saved from another session by comparing `LastSave` DateTime between the configuration and current `$PSProfile.LastSave`
2 parents 4781379 + 5e3ebcf commit d340408

File tree

3 files changed

+173
-133
lines changed

3 files changed

+173
-133
lines changed

CHANGELOG.md

Lines changed: 136 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,101 @@
11
* [PSProfile - ChangeLog](#psprofile---changelog)
2-
* [0.4.0 - 2019-09-22](#040---2019-09-22)
3-
* [0.3.0 - 2019-09-07](#030---2019-09-07)
4-
* [0.2.0 - 2019-09-02](#020---2019-09-02)
5-
* [0.1.9 - 2019-08-26](#019---2019-08-26)
6-
* [0.1.8 - 2019-08-26](#018---2019-08-26)
7-
* [0.1.7 - 2019-08-25](#017---2019-08-25)
8-
* [0.1.6 - 2019-08-24](#016---2019-08-24)
9-
* [0.1.5 - 2019-08-22](#015---2019-08-22)
10-
* [0.1.4 - 2019-08-22](#014---2019-08-22)
11-
* [0.1.3 - 2019-08-20](#013---2019-08-20)
12-
* [0.1.2 - 2019-08-20](#012---2019-08-20)
13-
* [0.1.1 - 2019-08-19](#011---2019-08-19)
14-
* [0.1.0 - 2019-08-19](#010---2019-08-19)
2+
* [0.4.1 - 2019-10-08](#041---2019-10-08)
3+
* [0.4.0 - 2019-09-22](#040---2019-09-22)
4+
* [0.3.0 - 2019-09-07](#030---2019-09-07)
5+
* [0.2.0 - 2019-09-02](#020---2019-09-02)
6+
* [0.1.9 - 2019-08-26](#019---2019-08-26)
7+
* [0.1.8 - 2019-08-26](#018---2019-08-26)
8+
* [0.1.7 - 2019-08-25](#017---2019-08-25)
9+
* [0.1.6 - 2019-08-24](#016---2019-08-24)
10+
* [0.1.5 - 2019-08-22](#015---2019-08-22)
11+
* [0.1.4 - 2019-08-22](#014---2019-08-22)
12+
* [0.1.3 - 2019-08-20](#013---2019-08-20)
13+
* [0.1.2 - 2019-08-20](#012---2019-08-20)
14+
* [0.1.1 - 2019-08-19](#011---2019-08-19)
15+
* [0.1.0 - 2019-08-19](#010---2019-08-19)
1516

1617
***
1718

1819
# PSProfile - ChangeLog
1920

21+
## 0.4.1 - 2019-10-08
22+
23+
* Miscellaneous
24+
* Added `LastSave` property to the primary `PSProfile` class
25+
* Added check on `Save()` method to pull in updated configuration if it has been saved from another session by comparing `LastSave` DateTime between the configuration and current `$PSProfile.LastSave`
26+
2027
## 0.4.0 - 2019-09-22
2128

2229
* [Issue #18](https://github.com/scrthq/PSProfile/issues/18)
23-
* Added the following functions for Init Script management:
24-
* `Add-PSProfileInitScript`
25-
* `Get-PSProfileInitScript`
26-
* `Remove-PSProfileInitScript`
27-
* `Enable-PSProfileInitScript`
28-
* `Disable-PSProfileInitScript`
29-
* `Edit-PSProfileInitScript`
30-
* Added contextual help file `about_PSProfile_Init_Scripts`
31-
* Added Init Scripts section to `Start-PSProfileConfigurationHelper`
32-
* Updated `PSProfile` class to include Init Script support.
30+
* Added the following functions for Init Script management:
31+
* `Add-PSProfileInitScript`
32+
* `Get-PSProfileInitScript`
33+
* `Remove-PSProfileInitScript`
34+
* `Enable-PSProfileInitScript`
35+
* `Disable-PSProfileInitScript`
36+
* `Edit-PSProfileInitScript`
37+
* Added contextual help file `about_PSProfile_Init_Scripts`
38+
* Added Init Scripts section to `Start-PSProfileConfigurationHelper`
39+
* Updated `PSProfile` class to include Init Script support.
3340
* Miscellaneous
34-
* Updated `Edit-PSProfilePrompt` when choosing to Save PSProfile to ensure the updated prompt is written back to disk.
35-
* Updated `invoke.build.ps1` for better contextual verbosity when compiling the module during the build process.
41+
* Updated `Edit-PSProfilePrompt` when choosing to Save PSProfile to ensure the updated prompt is written back to disk.
42+
* Updated `invoke.build.ps1` for better contextual verbosity when compiling the module during the build process.
3643

3744
## 0.3.0 - 2019-09-07
3845

3946
* [Issue #15](https://github.com/scrthq/PSProfile/issues/15)
40-
* Added `Add-PSProfileToProfile` function to easily add `Import-Module PSProfile` to your PowerShell profile.
47+
* Added `Add-PSProfileToProfile` function to easily add `Import-Module PSProfile` to your PowerShell profile.
4148
* [Issue #16](https://github.com/scrthq/PSProfile/issues/16)
42-
* Added the following functions from the `PSProfile.PowerTools` plugin to PSProfile directly:
43-
* `Confirm-ScriptIsValid`
44-
* `Enter-CleanEnvironment`
45-
* `Format-Syntax`
46-
* `Get-Definition`
47-
* `Get-Gist`
48-
* `Get-LongPath`
49-
* `Install-LatestModule`
50-
* `Open-Code`
51-
* `Open-Item`
52-
* `Pop-Path`
53-
* `Push-Path`
54-
* `Start-BuildScript`
55-
* `Test-RegEx`
56-
* Added HelpFile for Power Tools functions: `Get-Help about_PSProfile_Power_Tools`
57-
* Updated `Start-PSProfileConfigurationHelper` with Power Tools section
49+
* Added the following functions from the `PSProfile.PowerTools` plugin to PSProfile directly:
50+
* `Confirm-ScriptIsValid`
51+
* `Enter-CleanEnvironment`
52+
* `Format-Syntax`
53+
* `Get-Definition`
54+
* `Get-Gist`
55+
* `Get-LongPath`
56+
* `Install-LatestModule`
57+
* `Open-Code`
58+
* `Open-Item`
59+
* `Pop-Path`
60+
* `Push-Path`
61+
* `Start-BuildScript`
62+
* `Test-RegEx`
63+
* Added HelpFile for Power Tools functions: `Get-Help about_PSProfile_Power_Tools`
64+
* Updated `Start-PSProfileConfigurationHelper` with Power Tools section
5865
* Miscellaneous
59-
* Cleaned up `PSProfile` class.
60-
* Updated alias list.
61-
* Updated module versioning strategy in build script.
62-
* Updated `GitAliases` plugin to only spawn 1 runspace in the background.
63-
* Fixed issue with `Copy-Parameters` where it would fail to pull parameters for commands with multiple parameter sets.
64-
* Updated Content.Tests.
65-
* Updated azure-pipelines YAML.
66-
* Renamed the InvokeBuild script from `tasks.build.ps1` to `invoke.build.ps1`.
66+
* Cleaned up `PSProfile` class.
67+
* Updated alias list.
68+
* Updated module versioning strategy in build script.
69+
* Updated `GitAliases` plugin to only spawn 1 runspace in the background.
70+
* Fixed issue with `Copy-Parameters` where it would fail to pull parameters for commands with multiple parameter sets.
71+
* Updated Content.Tests.
72+
* Updated azure-pipelines YAML.
73+
* Renamed the InvokeBuild script from `tasks.build.ps1` to `invoke.build.ps1`.
6774

6875
## 0.2.0 - 2019-09-02
6976

7077
* [Issue #2](https://github.com/scrthq/PSProfile/issues/2)
71-
* Added special module import process when the `ModuleToImport` is `EditorServicesCommandSuite` so it also automatically registers the available editor commands.
78+
* Added special module import process when the `ModuleToImport` is `EditorServicesCommandSuite` so it also automatically registers the available editor commands.
7279
* [Issue #12](https://github.com/scrthq/PSProfile/issues/12)
73-
* Added `Start-PSProfileConfigurationHelper` to provide an easy way to get started with configuring your PSProfile.
80+
* Added `Start-PSProfileConfigurationHelper` to provide an easy way to get started with configuring your PSProfile.
7481
* [Issue #6](https://github.com/scrthq/PSProfile/issues/6)
75-
* Added `PSReadline` key to `$PSProfile.Settings` (Settings management in development still.)
82+
* Added `PSReadline` key to `$PSProfile.Settings` (Settings management in development still.)
7683
* Miscellaneous
77-
* Added support for multiple Command Aliases to be removed at once with `Remove-PSProfileCommandAlias`.
78-
* Updated default `SCRTHQ` prompt that comes with the module.
79-
* Added support for NerdFonts and PowerLine switches on the prompts to switch char sets depending on the FontType.
80-
* Added `IncludeVault` switch parameter to `Export-PSProfileConfiguration` to prevent exporting the Secrets Vault by default when creating portable configurations.
81-
* Added `_cleanModules()` method to PSProfile class to remove any null or empty values hanging over and convert any string values to the full hashtable value instead.
82-
* Cleaned up logic and fixed bugs in the following functions:
83-
* `Add-PSProfileModuleToImport`
84-
* `Remove-PSProfileModuleToImport`
85-
* `Add-PSProfileModuleToInstall`
86-
* `Remove-PSProfileModuleToInstall`
87-
* `Add-PSProfilePlugin`
88-
* Updated CONTRIBUTING.md with snippet to include for PSProfile developers on their PowerShell profile.
89-
* Refactored `Get-PSProfilePrompt` to return `$null` if a name is specified but does not exist on the current PSProfile configuration.
90-
* Refactored `$PSProfile._loadConfiguration()` to start with the base value of `$Global:PSProfile` if present, otherwise import the existing configuration from file. This is necessary to retain the existing configuration if an action is taken that forces the PSProfile to reload, e.g. adding a new plugin to the configuration.
91-
* Updated `$PSProfile._loadPrompt()` method to set the value of `$function:prompt` directly instead of calling `Switch-PSProfilePrompt` to reduce overhead.
84+
* Added support for multiple Command Aliases to be removed at once with `Remove-PSProfileCommandAlias`.
85+
* Updated default `SCRTHQ` prompt that comes with the module.
86+
* Added support for NerdFonts and PowerLine switches on the prompts to switch char sets depending on the FontType.
87+
* Added `IncludeVault` switch parameter to `Export-PSProfileConfiguration` to prevent exporting the Secrets Vault by default when creating portable configurations.
88+
* Added `_cleanModules()` method to PSProfile class to remove any null or empty values hanging over and convert any string values to the full hashtable value instead.
89+
* Cleaned up logic and fixed bugs in the following functions:
90+
* `Add-PSProfileModuleToImport`
91+
* `Remove-PSProfileModuleToImport`
92+
* `Add-PSProfileModuleToInstall`
93+
* `Remove-PSProfileModuleToInstall`
94+
* `Add-PSProfilePlugin`
95+
* Updated CONTRIBUTING.md with snippet to include for PSProfile developers on their PowerShell profile.
96+
* Refactored `Get-PSProfilePrompt` to return `$null` if a name is specified but does not exist on the current PSProfile configuration.
97+
* Refactored `$PSProfile._loadConfiguration()` to start with the base value of `$Global:PSProfile` if present, otherwise import the existing configuration from file. This is necessary to retain the existing configuration if an action is taken that forces the PSProfile to reload, e.g. adding a new plugin to the configuration.
98+
* Updated `$PSProfile._loadPrompt()` method to set the value of `$function:prompt` directly instead of calling `Switch-PSProfilePrompt` to reduce overhead.
9299

93100
## 0.1.9 - 2019-08-26
94101

@@ -149,70 +156,70 @@
149156
## 0.1.1 - 2019-08-19
150157

151158
* [Issue #3](https://github.com/scrthq/PSProfile/issues/3)
152-
* Fixed: `$PSProfile.Refresh()` only uses `Trim()` to clean up the Prompts now due to Invoke-Formatter hanging.
159+
* Fixed: `$PSProfile.Refresh()` only uses `Trim()` to clean up the Prompts now due to Invoke-Formatter hanging.
153160

154161
## 0.1.0 - 2019-08-19
155162

156163
* Initial release to the PowerShell Gallery
157164
* Included functions:
158-
* `Add-PSProfileCommandAlias`
159-
* `Add-PSProfileModuleToImport`
160-
* `Add-PSProfileModuleToInstall`
161-
* `Add-PSProfilePathAlias`
162-
* `Add-PSProfilePlugin`
163-
* `Add-PSProfileProjectPath`
164-
* `Add-PSProfilePrompt`
165-
* `Add-PSProfileScriptPath`
166-
* `Add-PSProfileSecret`
167-
* `Add-PSProfileSymbolicLink`
168-
* `Add-PSProfileVariable`
169-
* `Edit-PSProfilePrompt`
170-
* `Get-LastCommandDuration`
171-
* `Get-MyCreds`
172-
* `Get-PathAlias`
173-
* `Get-PSProfileArguments`
174-
* `Get-PSProfileCommand`
175-
* `Get-PSProfileCommandAlias`
176-
* `Get-PSProfileImportedCommand`
177-
* `Get-PSProfileLog`
178-
* `Get-PSProfileModuleToImport`
179-
* `Get-PSProfileModuleToInstall`
180-
* `Get-PSProfilePathAlias`
181-
* `Get-PSProfilePlugin`
182-
* `Get-PSProfileProjectPath`
183-
* `Get-PSProfilePrompt`
184-
* `Get-PSProfileScriptPath`
185-
* `Get-PSProfileSecret`
186-
* `Get-PSProfileSymbolicLink`
187-
* `Get-PSProfileVariable`
188-
* `Get-PSVersion`
189-
* `Import-PSProfile`
190-
* `Import-PSProfileConfiguration`
191-
* `Remove-PSProfileCommandAlias`
192-
* `Remove-PSProfileModuleToImport`
193-
* `Remove-PSProfileModuleToInstall`
194-
* `Remove-PSProfilePathAlias`
195-
* `Remove-PSProfilePlugin`
196-
* `Remove-PSProfileProjectPath`
197-
* `Remove-PSProfilePrompt`
198-
* `Remove-PSProfileScriptPath`
199-
* `Remove-PSProfileSecret`
200-
* `Remove-PSProfileSymbolicLink`
201-
* `Remove-PSProfileVariable`
202-
* `Save-PSProfile`
203-
* `Switch-PSProfilePrompt`
204-
* `Test-IfGit`
205-
* `Update-PSProfileConfig`
206-
* `Update-PSProfileRefreshFrequency`
207-
* `Update-PSProfileSetting`
208-
* `Write-PSProfileLog`
165+
* `Add-PSProfileCommandAlias`
166+
* `Add-PSProfileModuleToImport`
167+
* `Add-PSProfileModuleToInstall`
168+
* `Add-PSProfilePathAlias`
169+
* `Add-PSProfilePlugin`
170+
* `Add-PSProfileProjectPath`
171+
* `Add-PSProfilePrompt`
172+
* `Add-PSProfileScriptPath`
173+
* `Add-PSProfileSecret`
174+
* `Add-PSProfileSymbolicLink`
175+
* `Add-PSProfileVariable`
176+
* `Edit-PSProfilePrompt`
177+
* `Get-LastCommandDuration`
178+
* `Get-MyCreds`
179+
* `Get-PathAlias`
180+
* `Get-PSProfileArguments`
181+
* `Get-PSProfileCommand`
182+
* `Get-PSProfileCommandAlias`
183+
* `Get-PSProfileImportedCommand`
184+
* `Get-PSProfileLog`
185+
* `Get-PSProfileModuleToImport`
186+
* `Get-PSProfileModuleToInstall`
187+
* `Get-PSProfilePathAlias`
188+
* `Get-PSProfilePlugin`
189+
* `Get-PSProfileProjectPath`
190+
* `Get-PSProfilePrompt`
191+
* `Get-PSProfileScriptPath`
192+
* `Get-PSProfileSecret`
193+
* `Get-PSProfileSymbolicLink`
194+
* `Get-PSProfileVariable`
195+
* `Get-PSVersion`
196+
* `Import-PSProfile`
197+
* `Import-PSProfileConfiguration`
198+
* `Remove-PSProfileCommandAlias`
199+
* `Remove-PSProfileModuleToImport`
200+
* `Remove-PSProfileModuleToInstall`
201+
* `Remove-PSProfilePathAlias`
202+
* `Remove-PSProfilePlugin`
203+
* `Remove-PSProfileProjectPath`
204+
* `Remove-PSProfilePrompt`
205+
* `Remove-PSProfileScriptPath`
206+
* `Remove-PSProfileSecret`
207+
* `Remove-PSProfileSymbolicLink`
208+
* `Remove-PSProfileVariable`
209+
* `Save-PSProfile`
210+
* `Switch-PSProfilePrompt`
211+
* `Test-IfGit`
212+
* `Update-PSProfileConfig`
213+
* `Update-PSProfileRefreshFrequency`
214+
* `Update-PSProfileSetting`
215+
* `Write-PSProfileLog`
209216
* Included aliases:
210-
* `Creds` >> `Get-MyCreds`
211-
* `Edit-Prompt` >> `Edit-PSProfilePrompt`
212-
* `Get-Prompt` >> `Get-PSProfilePrompt`
213-
* `Load-PSProfile` >> `Import-PSProfile`
214-
* `Refresh-PSProfile` >> `Update-PSProfileConfig`
215-
* `Remove-Prompt` >> `Remove-PSProfilePrompt`
216-
* `Save-Prompt` >> `Add-PSProfilePrompt`
217-
* `Set-Prompt` >> `Switch-PSProfilePrompt`
218-
* `Switch-Prompt` >> `Switch-PSProfilePrompt`
217+
* `Creds` >> `Get-MyCreds`
218+
* `Edit-Prompt` >> `Edit-PSProfilePrompt`
219+
* `Get-Prompt` >> `Get-PSProfilePrompt`
220+
* `Load-PSProfile` >> `Import-PSProfile`
221+
* `Refresh-PSProfile` >> `Update-PSProfileConfig`
222+
* `Remove-Prompt` >> `Remove-PSProfilePrompt`
223+
* `Save-Prompt` >> `Add-PSProfilePrompt`
224+
* `Set-Prompt` >> `Switch-PSProfilePrompt`
225+
* `Switch-Prompt` >> `Switch-PSProfilePrompt`

PSProfile/Classes/PSProfile.Classes.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class PSProfile {
9696
[hashtable] $_internal
9797
[hashtable] $Settings
9898
[datetime] $LastRefresh
99+
[datetime] $LastSave
99100
[string] $RefreshFrequency
100101
[hashtable] $GitPathMap
101102
[hashtable] $PSBuildPathMap
@@ -156,6 +157,7 @@ class PSProfile {
156157
}
157158
$this.RefreshFrequency = (New-TimeSpan -Hours 1).ToString()
158159
$this.LastRefresh = [datetime]::Now.AddHours(-2)
160+
$this.LastSave = [datetime]::Now
159161
$this.ProjectPaths = @()
160162
$this.PluginPaths = @()
161163
$this.InitScripts = @{}
@@ -298,13 +300,38 @@ if ($env:AWS_PROFILE) {
298300
$this._formatInitScripts()
299301
$this.LastRefresh = [datetime]::Now
300302
$this.Save()
303+
$this._log(
304+
"Refresh complete",
305+
"MAIN",
306+
"Verbose"
307+
)
301308
}
302309
[void] Save() {
310+
$this._log(
311+
"Saving PSProfile configuration",
312+
"MAIN",
313+
"Debug"
314+
)
315+
$conf = Import-Configuration -Name PSProfile -CompanyName 'SCRT HQ' -DefaultPath (Join-Path $PSScriptRoot "Configuration.psd1")
316+
if ($conf.LastSave -gt $this.LastSave) {
317+
$this._log(
318+
"Configuration has been updated from another session @ $($conf.LastSave). Pulling in updated configuration before saving.",
319+
"MAIN",
320+
"Verbose"
321+
)
322+
$this | Update-Object $conf
323+
}
303324
$out = @{ }
325+
$this.LastSave = [DateTime]::Now
304326
$this.PSObject.Properties.Name | Where-Object { $_ -ne '_internal' } | ForEach-Object {
305327
$out[$_] = $this.$_
306328
}
307329
$out | Export-Configuration -Name PSProfile -CompanyName 'SCRT HQ'
330+
$this._log(
331+
"PSProfile configuration has been saved.",
332+
"MAIN",
333+
"Verbose"
334+
)
308335
}
309336
hidden [string] _globalize([string]$content) {
310337
$noScopePattern = 'function\s+(?<Name>[\w+_-]{1,})\s+\{'

0 commit comments

Comments
 (0)