-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.ps1
50 lines (40 loc) · 1.55 KB
/
default.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 {
$version = '0.0.0'
}
Task -Name Default -Depends Test
Task -Name Package -Depends Clean,Test, Version {
$buildPath = "./Build/Dist/AwsFederation/"
New-Item -ItemType Directory $buildPath
Copy-Item -Recurse ./src/* $buildPath
$manifest = Get-Content $buildPath/AwsFederation.psd1
$manifest = $manifest -Replace '%%VERSION%%', "$script:version"
Set-Content $buildPath/AwsFederation.psd1 $manifest
}
Task -Name Install -Depends Package,UnInstall {
$personalModulePath = $env:PSModulePath.Split(';').Split(':') | ? {$_.StartsWith($(Resolve-Path '~'))} | select-object -First 1
New-Item -ItemType Directory -Force $personalModulePath
Copy-Item -Recurse -Force ./Build/Dist/* $personalModulePath
}
Task Test {
New-Item -ItemType Directory -Force ./Build
$testResults = Invoke-Pester ./tests/ -OutputFile ./Build/TestResults.xml -OutputFormat NUnitXml -CodeCoverage @('./src/*.ps1') -PassThru
If ($testResults.FailedCount -ne 0)
{
throw "$($testResults.FailedCount) Unit Tests Failed"
}
}
Task -Name Clean {
Remove-Item -Recurse -Force -ErrorAction Ignore ./Build
}
Task -Name Version {
$script:version = Get-Content './version.txt'
Write-Output "Version $script:version"
}
Task -Name UnInstall {
$personalModulePath = $env:PSModulePath.Split(';').Split(':') | ? {$_.StartsWith($(Resolve-Path '~'))} | select-object -First 1
$modulePath = "$personalModulePath/AwsFederation/0.0.1"
if(Test-Path $modulePath)
{
Remove-Item -Recurse -Force $modulePath
}
}