diff --git a/Poke.psm1 b/Poke.psm1 index b690c00..1ea5946 100644 --- a/Poke.psm1 +++ b/Poke.psm1 @@ -929,6 +929,10 @@ Update-TypeData -typename Microsoft.PowerShell.Commands.MemberDefinition -Member # shortcut for $o | peek | gm function Get-PokeMember { $args | peek | Get-Member } +$ExecutionContext.SessionState.Module.OnRemove = { + remove-module poke_init -ErrorAction SilentlyContinue +} + # # Exports # diff --git a/changelog.txt b/changelog.txt index d8a5efb..01c2f2a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ fixes: - two tests were failing due to silly tests against private member counts to validate success; +- "init" script module is left loaded after a module unload - added onremove to unload it enhancements: - now support invoking methods with out/ref parameters (poewrshell treats both as [ref]) diff --git a/init.ps1 b/init.ps1 deleted file mode 100644 index 103b31f..0000000 --- a/init.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -# We run this outside of module scope in caller scope. -# We cannot use the manifest (PSD1) as it cannot override -# core formats because it uses -AppendPath semantics. - -update-formatdata -PrependPath (join-path $psscriptroot 'Poke.Format.ps1xml') diff --git a/poke.psd1 b/poke.psd1 index 83a2257..09b4d18 100644 --- a/poke.psd1 +++ b/poke.psd1 @@ -24,7 +24,7 @@ Author = 'Oisin Grehan' CompanyName = 'MVP' # Copyright statement for this module -Copyright = '(c) 2012 Oisin Grehan. All rights reserved.' +Copyright = '(c) 2012-2016 Oisin Grehan. All rights reserved.' # Description of the functionality provided by this module Description = "A PowerShell module for working with non-public types and instances. Ideal for live debugging of complex .net applications, or even introspection against powershell itself. Think open brain surgery for .NET." @@ -54,7 +54,7 @@ PowerShellVersion = '3.0' # RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module -ScriptsToProcess = @('init.ps1') +ScriptsToProcess = @('poke_init.ps1') # Type files (.ps1xml) to be loaded when importing this module # TypesToProcess = @() @@ -66,7 +66,7 @@ FormatsToProcess = @() # NestedModules = @() # Functions to export from this module -FunctionsToExport = '*' +FunctionsToExport = @('Get-Delegate', 'Get-PokeMember', 'Invoke-FormatHelper', 'New-InstanceProxy', 'New-ObjectProxy', 'New-TypeProxy') # Cmdlets to export from this module CmdletsToExport = '*' @@ -75,7 +75,7 @@ CmdletsToExport = '*' VariablesToExport = '*' # Aliases to export from this module -AliasesToExport = '*' +AliasesToExport = 'peek' # List of all modules packaged with this module # ModuleList = @() @@ -84,8 +84,32 @@ AliasesToExport = '*' # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' +PrivateData = @{ + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = 'debugging','hack','peek','reflection' + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/oising/poke' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + ReleaseNotes = '1.1 - added support for out/ref parameters.' + + # External dependent modules of this module + # ExternalModuleDependencies = '' + + } # End of PSData hashtable + + } # End of PrivateData hashtable + # HelpInfo URI of this module # HelpInfoURI = '' @@ -93,4 +117,3 @@ AliasesToExport = '*' # DefaultCommandPrefix = '' } -