<# FPS:Containers:Make:Private:Format-Changes:ACTIVE
#>
function Format-Changes {
<#
.DESCRIPTION
Module: Make
Private CmdLet:
Format-Changes.ps1
Has Dependencies: Yes
Displays the changes for the last n days for the {fps:[source]} directories and the {fps:media:web;admin:views:pages:src}. The default delta is
the last day.
.EXAMPLE
if (Push-NeededFor Format-Changes) { .
(Get-ActiveFileNm -PS1 Format-Changes) }
$overrideSrc = 'CICD' # CICD
has a duplicate need for the the locations needed for
this shortcut
. (Get-ActiveFileNm -PS1
Initialize-Make-Locations)
$title,$Delta,$Source,$ComparePath,$ComplementPath,$overrideSnippet
=
'Containers',3,'Runtime',$makLoc_CICDSourceContainers,$makLoc_CICDTargetContainers,'SC-Changes'
# For testing
Format-Changes -Title $title -Delta 2 -Source 'Runtime' -ComparePath $ComparePath -ComplementPath $ComplementPath
.CC
[2025.03.18 JD] Updated the listing headings so that they
make a little more sence.
[2024.11.16 JD] Original code release. Decreased the code
footprint by 75% by using this Cmd
.NOTES
Since Get-Folder uses a GMT time, everything will be +5
hours on the day span. We can correct
this within the output, but the
search itself will yeild some
mysterious results for items updated around day change. May want to see about updating Get-Folder
to see about more precise time.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)] [string]$Title, # Title of the list
[Parameter(Mandatory=$false)] [int]$Delta=2, # Number of days back for a change
[Parameter(Mandatory=$false)] [string]$Source='Runtime', #
Runtime or Source
[Parameter(Mandatory=$false)] [string]$ComparePath, #
Path where changes are found
[Parameter(Mandatory=$false)] [string]$ComplementPath # Location of the complement path
)
<# $overrideSrc = 'CICD' #
CICD has a duplicate need for the the locations
needed for this shortcut
. (Get-ActiveFileNm -PS1 Initialize-Make-Locations)
$title,$Delta,$Source,$ComparePath,$ComplementPath,$overrideSnippet
=
'Containers',3,'Runtime',$makLoc_CICDSourceContainers,$makLoc_CICDTargetContainers,'SC-Changes'
# For testing
#>
. (Get-ActiveFileNm -PS1 Load-Make-Dependencies)
$CompareSet = Get-Folder -Path $ComparePath -MaxAge $Delta | Select FullName, Name
$ComplementSet = Get-Folder -Path $ComplementPath -MaxAge $Delta | Select FullName, Name
if ($Title -in ("Containers","Metadata")) { $Tms1, $Tms2 = 75, 97 } else { $Tms1, $Tms2 = 120, 142 }
if ($Source -eq 'Runtime') {
$Tstr = (ConvertTo-SpaceFill $Tms1 "Filename")+"Runtime File Tms Source File Tms"
$Tlin = (ConvertTo-SpaceFill $Tms1 "--------")+"------------------- -------------------"
$Source = "Runtime" # Redo case for output
} else {
$Tstr = (ConvertTo-SpaceFill $Tms1 "Filename")+"Source File Tms Runtime File Tms"
$Tlin = (ConvertTo-SpaceFill $Tms1 "--------")+"------------------- -------------------"
$Source = "Source" # Redo case for output
}
if ($Title -in ("Containers","Metadata")) {
$Tstr += " Local_Sites Tms Runtime
Listing Tms"
$Tlin += "
-------------------
---------------------"
}
Write-Output "$Source $Title..."
Write-Output $Tstr; Write-Output $Tlin
foreach ($Fnm in $CompareSet) {
$hightlight = $false
# Need to write some source for theses
if ($Title -in ("Containers","Metadata")) {
if (Test-Path ($global:pro_Locations.FoundationalOpsAdminSrc+'\'+($Fnm.Name).replace(".ps1",".htm"))) {
$RTSrcTm = [string](Get-ItemProperty -Path ($global:pro_Locations.FoundationalOpsAdminSrc+'\'+($Fnm.Name).replace(".ps1",".htm")) -Name LastWriteTime).lastwritetime
} else {
$RTSrcTm = "*******************"
$highlight = $true
}
if (Test-Path ($global:pro_Locations.LocalFoundationalOpsAdminSrc+'\'+($Fnm.Name).replace(".ps1",".htm"))) {
$LCSrcTm = [string](Get-ItemProperty -Path ($global:pro_Locations.LocalFoundationalOpsAdminSrc+'\'+($Fnm.Name).replace(".ps1",".htm")) -Name LastWriteTime).lastwritetime
} else {
$LCSrcTm = "*******************"
$highlight = $true
}
$tm1 = [string](Get-ItemProperty -Path $FNm.FullName -Name LastWriteTime).lastwritetime
if ($RTSrcTm -eq $LCSrcTm) {
if ($LCSrcTm -lt $tm1) { $highlight = $true }
} else { $highlight = $true }
} else {
$tm1 = [string](Get-ItemProperty -Path $FNm.FullName -Name LastWriteTime).lastwritetime
}
if ($Title -in ("Containers","Metadata")) {
$str = (ConvertTo-SpaceFill $Tms1 (Format-FileHandle -FQFn $FNm.FullName))+$tm1
} else {
$str = (ConvertTo-SpaceFill $Tms1 $FNm.FullName)+$tm1
}
$src = ([string]$FNm.FullName).replace($ComparePath,$ComplementPath)
if (Test-Path $src) {
$tm2 = [string](Get-ItemProperty -Path $src -Name LastWriteTime).lastwritetime
$Str = (ConvertTo-SpaceFill $Tms2 $str)+$tm2
if ($Title -in ("Containers","Metadata")) {
$str += '
'+$LCSrcTm+" "+$RTSrcTm
}
if (!($tm1 -eq $tm2)) { $higlight = $true }
} else { $highlight = $true }
if ($highlight) {
$Host.UI.RawUI.ForegroundColor = "Red"
Write-Output $str
$Host.UI.RawUI.ForegroundColor = "White"
$highlight = $false
} else {
Write-Output $str
}
}
Write-Output ' '
}