Initialize-ForgeContext.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
$Script:ForgeContexts = @{} function Initialize-ForgeContext { <# .SYNOPSIS Initializes the context in which all generation fonctions will work. .DESCRIPTION Sets up the context for other Forge functions to reuse. .EXAMPLE Initialize-ForgeContext -SourceRoot (Join-Path $PSScriptRoot "Templates") -DestinationPath $Path #> [CmdletBinding()] Param( [String]$SourceRoot, [Parameter(Mandatory = $true)] [String]$DestinationPath, [Hashtable]$Binding = @{}, [String]$ContextName = $(Get-CallerModuleName) ) $Script:ForgeContexts[$ContextName] = @{ SourceRoot = $SourceRoot DestinationPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($DestinationPath) Binding = $Binding } } |