PowerCraft.OCI.psm1
|
# PowerCraft.OCI: thin PowerShell shell over the PowerCraft.OCI.Core kernel. # The shell owns binding, output shaping and safety affordances; every algorithm lives in the kernel. # lib/ is populated by build.ps1 from the kernel build and shipped inside the module. $script:ModuleRoot = $PSScriptRoot $script:PCOciContext = $null $libDir = Join-Path $PSScriptRoot 'lib' $kernelDll = Join-Path $libDir 'PowerCraft.OCI.Core.dll' if (-not (Test-Path -LiteralPath $kernelDll)) { throw "PowerCraft.OCI kernel not found at '$kernelDll'. Run build.ps1 at the repository root to populate module/lib/." } # The kernel first, then the SDK and its dependencies. Assemblies PowerShell already provides (Newtonsoft.Json # among them) are skipped when the runtime says so; the kernel binds to whichever copy is loaded. foreach ($dll in Get-ChildItem -Path $libDir -Filter '*.dll' | Sort-Object Name) { try { Add-Type -Path $dll.FullName -ErrorAction Stop } catch { if ($_.Exception -is [System.IO.FileLoadException] -or $_.Exception.Message -match 'already (been )?loaded') { Write-Verbose "Skipped $($dll.Name): already provided by the runtime." } else { throw } } } foreach ($folder in @('Private', 'Public')) { $dir = Join-Path $PSScriptRoot $folder if (-not (Test-Path -LiteralPath $dir)) { continue } foreach ($function in Get-ChildItem -Path $dir -Filter '*.ps1' | Sort-Object Name) { . $function.FullName } } Export-ModuleMember -Function 'Connect-PCOci', 'Test-PCOciAccess', 'Export-PCOciSnapshot', 'Get-PCOciUsage', 'New-PCOciFixture', 'Test-PCOciSnapshot' |