<# FPS:Metadata:Pro-Config:ACTIVE
#>
<#
.DESCRIPTION
Metadata Baseline: Pro-Config.ps1
The snippet has been drastically simplified in the Aloha
release. It used to load massive amounts
of configuration files for the architecture to
function, but this was mainly because of the significant
patching that occurred to the code without a major family release. Its
now fairly simple
and straightforward with no external configurations to be
concerned with.
Since the use of the Module Principle has been re-defined
(although the directories and structures remain in module form) in the Aloha
release,
this file loads the internal key dependencies
first and then configures the environment shortcuts for use.
The config is called by profile.ps1 when accessed by the
UI and is called by the action when loaded for ServiceNow.
.EXAMPLE
.
($global:pro_CIBase.RuntimeMetadata+"\FPS\MetaData\Pro-Config.ps1")
.CC
[2024.09.28 JD] Modules must be added to the $global:pro_Release before they can be recognized. Statement
Depricated later on.
[2024.09.24 JD] The prior release had a limitation of
using the P1 patch for all shortcuts. The code was changed to pick up only the
active
version regardless of the patch/family release it is in.
[2024.09.18 JD] Instead of using the base version of Get-ActiveFileNm, added the code to search for itself so the
active one is always loaded.
[2024.09.16 JD] Original code release
.NOTES
#>
# In order to to load ps1's from the correct version, we will first have
to load the Active file locator CmdLet in Make. This uses a condensed
# version of the function to locate itself first.
$FoundAt = Get-ChildItem ($global:pro_CIBase.RuntimeRoot+'\Containers') -Recurse | Select-String -Pattern 'Get-ActiveFileNm:ACTIVE'
if ($FoundAt.length -eq 1) { [string]$CurrentPS1=$FoundAt } else { [string]$CurrentPS1=$FoundAt[$FoundAt.length-1] }
$SpCurrentPS1 = $CurrentPS1.split(':')
. ($SpCurrentPS1[0]+':'+$SpCurrentPS1[1])
# Now load Key foundational functions to be used in
conjunction with Get-ActiveFileNm.
if (Get-Command -Name "Push-NeededFor" -ErrorAction SilentlyContinue) {
Remove-Item -Path Function:\Push-NeededFor }
. (Get-ActiveFileNm -PS1 Push-NeededFor) # Key foundational function. Used throughout FPS to determine if a Cmdlet
needs to be loaded
# The basic load functionality is in place. An example of its use is:
# if (Push-NeededFor
Get-Answer) { . (Get-ActiveFileNm
-PS1 Get-Answer) }
# Load the final key function
if (Get-Command -Name "Mount-Path" -ErrorAction SilentlyContinue) {
Remove-Item -Path Function:\Mount-Path }
. (Get-ActiveFileNm -PS1 Mount-Path) # Key foundational function. Used throughout FPS to create a FQ path if
not there.
# Core foundational CmdLets.
These CmdLets and Key CmdLets
should always be available.
if (Push-NeededFor Get-Answer) { .
(Get-ActiveFileNm -PS1 Get-Answer) } # Key foundational function. Used to ask
Q&A
# This is the only notation where the Modules are
noted. New modules must be added to the
$global:pro_Release before they can be
# recognized.
$cfgMods = Get-ChildItem -Path ($global:pro_CIBase.RuntimeRoot+'\Containers\'+$global:pro_Release)
foreach ($cfgMod in $cfgMods) {
if ($global:FPSModules -gt "") { $global:FPSModules += ','+$cfgMod.Name } else { $global:FPSModules = $cfgMod.Name }
}
# Shortcuts
$cfgShortcuts = Get-ChildItem -Path ($global:pro_CIBase.RuntimeRoot+"\Containers\*\*\SC-*.ps1")
-Force -ErrorAction SilentlyContinue | Select-String -Pattern ':ACTIVE'
foreach ($Shortcut in $cfgShortcuts) {
$SpShortcut = ([string]$ShortCut).split(":")
. ($SpShortcut[0]+':'+$SpShortcut[1])
}