<# .SYNOPSIS One-line web launcher for a ShopDB dev workstation. .DESCRIPTION The piece that makes `iex (irm .../get.ps1)` work. dev-bootstrap.ps1 operates on a local clone, so it cannot be run straight from the web. This launcher fills that gap: it clones (or updates) the repo at the channel branch into a stable local path, then hands off to scripts/dev-bootstrap.ps1 for the real dependency-check / build / up work. Channel is chosen by an environment variable so a pure `iex` pipe (which cannot pass parameters) still selects stable vs edge: # Stable (main): $env:SHOPDB_CHANNEL='stable'; iex (irm https://raw.githubusercontent.com/ge-aero/shopdb-flask/wilm/scripts/get.ps1) # Bleeding edge (dev-be): $env:SHOPDB_CHANNEL='edge'; iex (irm https://raw.githubusercontent.com/ge-aero/shopdb-flask/wilm/scripts/get.ps1) SHOPDB_DIR overrides the clone location (default %USERPROFILE%\shopdb-dev). .NOTES ASCII only, no emoji or smart punctuation, per repo style. PowerShell 5.1+. Runs git-checkout of the channel branch, so it needs Git; dev-bootstrap.ps1 offers to winget-install anything else that is missing. #> $ErrorActionPreference = 'Stop' $repoUrl = 'https://github.com/ge-aero/shopdb-flask.git' $channel = if ($env:SHOPDB_CHANNEL) { $env:SHOPDB_CHANNEL } else { 'stable' } if ($channel -notin @('stable', 'edge')) { throw "SHOPDB_CHANNEL must be 'stable' or 'edge' (got '$channel')." } $branch = if ($channel -eq 'edge') { 'dev-be' } else { 'main' } $target = if ($env:SHOPDB_DIR) { $env:SHOPDB_DIR } else { Join-Path $env:USERPROFILE 'shopdb-dev' } Write-Host "ShopDB web launcher" -ForegroundColor White Write-Host " Channel : $channel ($branch)" -ForegroundColor White Write-Host " Target : $target" -ForegroundColor White if (-not (Get-Command git -ErrorAction SilentlyContinue)) { throw 'git is required to clone the repo. Install Git (winget install Git.Git) and re-run.' } if (Test-Path (Join-Path $target '.git')) { Write-Host "==> Updating existing clone" -ForegroundColor Cyan git -C $target fetch origin $branch if ($LASTEXITCODE -ne 0) { throw "git fetch failed ($LASTEXITCODE)." } git -C $target checkout $branch if ($LASTEXITCODE -ne 0) { throw "git checkout failed ($LASTEXITCODE)." } git -C $target pull --ff-only origin $branch if ($LASTEXITCODE -ne 0) { throw "git pull failed ($LASTEXITCODE)." } } else { Write-Host "==> Cloning $branch" -ForegroundColor Cyan git clone --branch $branch $repoUrl $target if ($LASTEXITCODE -ne 0) { throw "git clone failed ($LASTEXITCODE)." } } $bootstrap = Join-Path $target 'scripts\dev-bootstrap.ps1' if (-not (Test-Path $bootstrap)) { throw "dev-bootstrap.ps1 not found at $bootstrap. Is the branch correct?" } Write-Host "==> Handing off to dev-bootstrap.ps1" -ForegroundColor Cyan & $bootstrap -Channel $channel