41 lines
1.4 KiB
PowerShell
41 lines
1.4 KiB
PowerShell
|
Function Join-PSM1FromFiles {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Uses Get-ContentFromFilesInPath to join the file contents appropriately
|
||
|
|
||
|
.DESCRIPTION
|
||
|
Collects all content from valid files for inclusion into the PSM1
|
||
|
* Skips test files
|
||
|
* Adds a header line saying where the file came from during compile
|
||
|
The reason for these files to match their names is about process, not a functional concern.
|
||
|
|
||
|
.EXAMPLE
|
||
|
Join-PSM1FromFiles .\Alkami.PowerShell.IIS\Public\ .\Alkami.PowerShell.IIS\Private\ .\Alkami.PowerShell.IIS\Alkami.PowerShell.IIS.psm1
|
||
|
|
||
|
.PARAMETER PublicPath
|
||
|
The name of the folder to examine all files under.
|
||
|
|
||
|
.PARAMETER PrivatePath
|
||
|
The name of the folder to examine all files under. Tested for existence, may not be valid.
|
||
|
|
||
|
.PARAMETER Psm1FilePath
|
||
|
The file to overwrite with the contents of the build process.
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
Param (
|
||
|
[String]$PublicPath,
|
||
|
[String]$PrivatePath,
|
||
|
$Psm1FilePath
|
||
|
)
|
||
|
process {
|
||
|
## Put all of the content from the public files in a long array with a file-header
|
||
|
$functionLines = @(Get-ContentFromFilesInPath $PublicPath)
|
||
|
|
||
|
if (Test-Path $PrivatePath) {
|
||
|
## Put all of the content from the private files in the array with a file-header, after the public functions
|
||
|
$functionLines += @(Get-ContentFromFilesInPath $PrivatePath)
|
||
|
}
|
||
|
|
||
|
Set-Content -Path $Psm1FilePath -Value $functionLines -Force
|
||
|
}
|
||
|
}
|