Update SPLIT-samy.ps1

This commit is contained in:
2026-01-24 20:52:20 -05:00
parent c1c11ab771
commit 370a2e3907

View File

@@ -44,22 +44,18 @@ function Import-SamyChunk {
[Parameter(Mandatory)][string]$Name
)
try {
Write-Host "[Info] Loading chunk: $Name" -ForegroundColor Cyan
$content = (Invoke-WebRequest -UseBasicParsing -Uri $Url -ErrorAction Stop).Content
Write-Host "[Info] Loading chunk: $Name" -ForegroundColor Cyan
$content = (Invoke-WebRequest -UseBasicParsing -Uri $Url -ErrorAction Stop).Content
if ([string]::IsNullOrWhiteSpace($content)) {
throw "Downloaded content was empty."
}
if ([string]::IsNullOrWhiteSpace($content)) {
throw "Downloaded content was empty."
}
. ([ScriptBlock]::Create($content))
Write-Host "[Success] Loaded: $Name" -ForegroundColor Green
}
catch {
throw "Failed to load chunk '$Name' from $Url. $($_.Exception.Message)"
}
Write-Host "[Success] Downloaded: $Name" -ForegroundColor Green
return $content
}
# Single source of truth for where chunks live
# (Matches your current inline values)
$Script:SamyGitURL = 'https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch'
@@ -107,9 +103,12 @@ $chunks = @(
)
foreach ($c in $chunks) {
. Import-SamyChunk -Url $c.Url -Name $c.Name
$content = Import-SamyChunk -Url $c.Url -Name $c.Name
. ([ScriptBlock]::Create($content))
Write-Host "[Success] Loaded: $($c.Name)" -ForegroundColor Green
}
if (-not (Get-Command Invoke-ScriptAutomationMonkey -ErrorAction SilentlyContinue)) {
throw "Bootstrap loaded chunks, but Invoke-ScriptAutomationMonkey was not found. Ensure src/core.ps1 defines it."
}