-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPoShPal.build.ps1
51 lines (45 loc) · 1.58 KB
/
PoShPal.build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$srcPath = "$PSScriptRoot\src"
$buildPath = "$PSScriptRoot\build"
$docPath = "$PSScriptRoot\docs"
$moduleName = "PoShPal"
$modulePath = "$buildPath\$moduleName"
$author = 'Anthony Howell'
$version = '0.0.4'
task Clean {
If(Get-Module $moduleName){
Remove-Module $moduleName
}
If(Test-Path $modulePath){
$null = Remove-Item $modulePath -Recurse -ErrorAction Ignore
}
}
task DocBuild {
New-ExternalHelp $docPath -OutputPath "$modulePath\EN-US"
}
task ModuleBuild Clean, DocBuild, {
$classFiles = Get-ChildItem "$srcPath\Classes" -Filter *.ps1 -File
$pubFiles = Get-ChildItem "$srcPath\public" -Filter *.ps1 -File
$privFiles = Get-ChildItem "$srcPath\private" -Filter *.ps1 -File
If(-not(Test-Path $modulePath)){
New-Item $modulePath -ItemType Directory
}
ForEach($file in ($classFiles + $pubFiles + $privFiles)) {
Get-Content $file.FullName | Out-File "$modulePath\$moduleName.psm1" -Append -Encoding utf8
}
Copy-Item "$srcPath\$moduleName.psd1" -Destination $modulePath
$moduleManifestData = @{
Author = $author
Copyright = "(c) $((get-date).Year) $author. All rights reserved."
Path = "$modulePath\$moduleName.psd1"
FunctionsToExport = $pubFiles.BaseName
RootModule = "$moduleName.psm1"
ModuleVersion = $version
ProjectUri = 'https://github.com/theposhwolf/PoShPal'
}
Update-ModuleManifest @moduleManifestData
Import-Module $modulePath -RequiredVersion $version
}
task Publish {
Invoke-PSDeploy -Path $PSScriptRoot -Force
}
task All ModuleBuild, Publish