Private/Get-KadenRequiredIgnoreLine.ps1
|
function Get-KadenRequiredIgnoreLine { <# .SYNOPSIS Read transactional ignore lines from the seed inventory. .DESCRIPTION Uses Seeds/manifest.psd1 GitIgnore and the Gallery path of that seed file. Blank lines and comments are not required entries. #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$SeedRoot, [Parameter(Mandatory = $true)] [hashtable]$Manifest ) $relative = [string]$Manifest.GitIgnore if ([string]::IsNullOrWhiteSpace($relative)) { throw 'KDN-SEED-MISSING: Seeds/manifest.psd1 has no GitIgnore entry.' } $source = Resolve-KadenContainedPath -Root $SeedRoot -RelativePath (ConvertTo-KadenGalleryRelativePath -RelativePath $relative) if (-not (Test-Path -LiteralPath $source -PathType Leaf)) { throw "KDN-SEED-MISSING: transactional gitignore seed is not in the module ('$relative')." } $required = @( Get-Content -LiteralPath $source | ForEach-Object { $_.TrimEnd() } | Where-Object { -not [string]::IsNullOrWhiteSpace($_) -and -not $_.StartsWith('#') } ) if ($required.Count -lt 1) { throw "KDN-SEED-MISSING: transactional gitignore seed has no entries ('$relative')." } return $required } |