-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
!deploy v0.5.0 ready for release (#20)
## 0.5.0 - 2019-10-08 * Miscellaneous * Added FileWatcher event registration to update current `$global:PSProfile` object whenever the Configuration.psd1 file has changed, enabling configuration persistence across sessions. Configuration additions and removals from one PowerShell session will immediately be reflected in other active sessions. * Removed the persistence workaround the `Save()` method in favor of the Configuration.psd1 FileWatcher method.
- Loading branch information
Showing
5 changed files
with
28 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,24 @@ | ||
# If we're in an interactive shell, load the profile. | ||
if ([Environment]::UserInteractive -or ($null -eq [Environment]::UserInteractive -and $null -eq ([Environment]::GetCommandLineArgs() | Where-Object {$_ -like '-NonI*'}))) { | ||
if ([Environment]::UserInteractive -or ($null -eq [Environment]::UserInteractive -and $null -eq ([Environment]::GetCommandLineArgs() | Where-Object { $_ -like '-NonI*' }))) { | ||
$global:OriginalPrompt = | ||
$global:PSProfile = [PSProfile]::new() | ||
$global:PSProfile.Load() | ||
Export-ModuleMember -Variable PSProfile | ||
$global:PSProfileConfigurationWatcher = [System.IO.FileSystemWatcher]::new($(Split-Path $global:PSProfile.Settings.ConfigurationPath -Parent),'Configuration.psd1') | ||
$job = Register-ObjectEvent -InputObject $global:PSProfileConfigurationWatcher -EventName Changed -Action { | ||
[PSProfile]$conf = Import-Configuration -Name PSProfile -CompanyName 'SCRT HQ' -Verbose:$false | ||
$conf._internal = $global:PSProfile._internal | ||
$global:PSProfile = $conf | ||
} | ||
$PSProfile_OnRemoveScript = { | ||
try { | ||
$global:PSProfileConfigurationWatcher.Dispose() | ||
} | ||
finally { | ||
Remove-Variable PSProfile -Scope Global -Force | ||
Remove-Variable PSProfileConfigurationWatcher -Scope Global -Force | ||
} | ||
} | ||
$ExecutionContext.SessionState.Module.OnRemove += $PSProfile_OnRemoveScript | ||
Register-EngineEvent -SourceIdentifier ([System.Management.Automation.PsEngineEvent]::Exiting) -Action $PSProfile_OnRemoveScript | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters