Added module building
This commit is contained in:
25
psake.ps1
25
psake.ps1
@@ -93,6 +93,31 @@ Task Build -Depends Test {
|
|||||||
Write-Host "Using version: $version"
|
Write-Host "Using version: $version"
|
||||||
|
|
||||||
Update-Metadata -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -Value $version
|
Update-Metadata -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -Value $version
|
||||||
|
|
||||||
|
$psm1 = "$PSScriptRoot\$env:BHProjectName\$env:BHProjectName.psm1"
|
||||||
|
Remove-Item $psm1
|
||||||
|
|
||||||
|
# keep the first line in the psm1 file and clear the rest
|
||||||
|
Get-Content -Path $psm1 -TotalCount 1 | Set-Content -Path $psm1
|
||||||
|
foreach ( $folder in ('Classes', 'Public', 'Private') )
|
||||||
|
{
|
||||||
|
Add-Content -Path $psm1 -Value "Write-Verbose 'Importing from [$folder]'"
|
||||||
|
$imports = Get-ChildItem "$PSScriptRoot\$env:BHProjectName\$folder\*.ps1" -Exclude *.Tests.ps1
|
||||||
|
foreach ( $file in $imports )
|
||||||
|
{
|
||||||
|
Add-Content -Path $psm1 -Value ''
|
||||||
|
Add-Content -Path $psm1 -Value "Write-Verbose ' Source [\$folder\$($file.name)]'"
|
||||||
|
[System.IO.File]::ReadAllText($file.fullname) | Add-Content -Path $psm1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove folders after import
|
||||||
|
Remove-Item "$PSScriptRoot\$env:BHProjectName\$folder" -Recurse
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add exports
|
||||||
|
Add-Content -Path $psm1 -Value "Export-ModuleMember -Function $($functions -join ', ')"
|
||||||
|
|
||||||
|
Import-Module $psm1 -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
Task Deploy -Depends Build {
|
Task Deploy -Depends Build {
|
||||||
|
|||||||
Reference in New Issue
Block a user