diff --git a/samy.ps1 b/samy.ps1 index a1928a0..2686675 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -61,36 +61,28 @@ function Import-SamyChunk { [CmdletBinding()] param( [Parameter(Mandatory)][string]$Url, - [Parameter(Mandatory)][string]$Name, - [Parameter(Mandatory)][string]$LocalPath + [Parameter(Mandatory)][string]$Name ) try { - # Download $content = (Invoke-WebRequest -UseBasicParsing -Uri $Url -ErrorAction Stop).Content if ([string]::IsNullOrWhiteSpace($content)) { throw "Downloaded content was empty." } - # Save (UTF-8 no BOM) - $utf8NoBom = New-Object System.Text.UTF8Encoding($false) - [System.IO.File]::WriteAllText($LocalPath, $content, $utf8NoBom) - - # Load - . $LocalPath - Write-Host ("[Success] {0}" -f $Name) -ForegroundColor Green - return $true + return $content } catch { $msg = $_.Exception.Message if ([string]::IsNullOrWhiteSpace($msg)) { $msg = "$_" } Write-Host ("[Failed] {0}: {1}" -f $Name, $msg) -ForegroundColor Red - return $false + throw } } + # 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'