Skip to content

Commit

Permalink
Fixed update module
Browse files Browse the repository at this point in the history
  • Loading branch information
ntatschner committed Apr 4, 2024
1 parent bd2fccb commit ceb298b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions Modules/Tatux.Utils/Public/Update-NTModuleManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ function Update-NTModuleManifest {
if ([string]::IsNullOrEmpty($ManifestFileContent -match '[\s|\t]*CmdletsToExport\s*=.*') -eq $false) {
$LineWithCmdletsToExport = $($ManifestFileContent | Select-String -Pattern '^[\s|\t]*CmdletsToExport\s*=(.*)$')
$LineNumber = $LineWithCmdletsToExport.LineNumber - 1
$ManifestFileLines = $ManifestFileContent -split "`n"
$CmdletsToExport = $(Get-ChildItem -Path $PublicFunctions -Filter "*.ps1" | Where-Object { $_.Name -notlike "*.tests.ps1" | select Name }) -join ', '
$NewLine = "CmdletsToExport = @($CmdletsToExport)"
Write-Output "Replacing line: $LineWithCmdletsToExport with $NewLine"
$ManifestFileContent = $ManifestFileLines[$LineNumber] -replace [regex]::Escape($LineWithCmdletsToExport.Matches.Groups[1].Value), $NewLine
$ManifestFileContent = $ManifestFileLines -join "`n"
$CmdletsToExport = $(Get-ChildItem -Path $PublicFunctions -Filter "*.ps1" | Where-Object { $_.Name -notlike "*.tests.ps1" } | Select-Object -ExpandProperty BaseName ) -join ', '
$NewLine = " @($CmdletsToExport)"
Write-Output "Replacing line: $($LineWithCmdletsToExport.Matches.Groups[1].Value) with $NewLine"
$ManifestFileContent[$LineNumber] = $ManifestFileContent[$LineNumber] -replace [regex]::Escape($LineWithCmdletsToExport.Matches.Groups[1].Value), $NewLine
Set-Content -Path $Path -Value $ManifestFileContent
} else {
Write-Error "CmdletsToExport field could not be found in the manifest file."
Expand Down
2 changes: 1 addition & 1 deletion Modules/Tatux.Utils/Tatux.Utils_test.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@

} # End of PrivateData hashtable

}
}

0 comments on commit ceb298b

Please sign in to comment.