-
Notifications
You must be signed in to change notification settings - Fork 1
/
psake.ps1
50 lines (48 loc) · 2.09 KB
/
psake.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
Properties{
$env:ProjectRoot = $PSScriptRoot
$ErrorActionPreference = "Stop"
}
Task Manual -depends Build
Task Build -depends Clean {
#build module file
$scriptFiles = Get-ChildItem $env:ProjectRoot\src -Filter *.ps1 -Recurse -Exclude *.ps1xml
$functionsToExport = Get-ChildItem $env:ProjectRoot\src\public | %{$_.name.replace(".ps1","")}
#$formatsToExport = Get-ChildItem $env:ProjectRoot\src\classes -Filter *format.ps1xml
If(-not(Test-Path $env:ModuleTempDir\$env:ModuleName)){
New-Item $env:ModuleTempDir\$env:ModuleName -ItemType Directory | Out-Null
}
ForEach($file in $scriptFiles) {
Get-Content $file.FullName | Out-File $env:ModuleTempDir\$env:ModuleName\$env:ModuleName.psm1 -Append -Encoding ASCII
}
Copy-Item $env:ProjectRoot\src\$env:ModuleName.psd1 $env:ModuleTempDir\$env:ModuleName\$env:ModuleName.psd1
<#ForEach($format in $formatsToExport){
Copy-Item $format.FullName -Destination $env:ModuleTempDir\$env:ModuleName\$format
'Update-FormatData $PSScriptRoot\' + $($format.name) | Out-File $env:ModuleTempDir\$env:ModuleName\$env:ModuleName.psm1 -Append
}#>
$moduleManifestData = @{
Author = $env:Author
Copyright = "(c) $((get-date).Year) $env:Author. All rights reserved."
Path = "$env:ModuleTempDir\$env:ModuleName\$env:ModuleName.psd1"
FunctionsToExport = $FunctionstoExport
RootModule = "$env:ModuleName.psm1"
ModuleVersion = $env:ModuleVersion
#FormatsToProcess = $formatsToExport
}
Update-ModuleManifest @moduleManifestData
Import-Module $env:ModuleTempDir\$env:ModuleName -RequiredVersion $env:ModuleVersion
New-ExternalHelp -Path $env:ProjectRoot\docs\ -OutputPath $env:ModuleTempDir\$env:ModuleName\en-us
}
Task Test -depends Build {
#still need to create pester tests
}
Task Analyze -depends Build {
#still need to get my PSScriptANalyzer going
}
Task Deploy -depends Test,Analyze {
#eventually
}
Task Clean {
If(Test-Path $env:ModuleTempDir\$env:ModuleName){
Remove-Item $env:ModuleTempDir\$env:ModuleName -Recurse -Force
}
}