-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.ps1
45 lines (37 loc) · 1.08 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
Framework "4.6"
properties {
$buildFile = resolve-path ".\PsakeDemo.sln"
$vstestpath = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
$environment = $env
$testPackage = $tests
}
FormatTaskName "-------------------- {0} --------------------"
Task default -Depends Build
Task Build {
"Building $environment"
msbuild $buildFileName /t:Build /p:Configuration=Debug /v:minimal
}
# psake Build -parameters "@{'env'='dev'}"
Task Test -Depends Build {
"Testing $testPackage"
& $vstestpath PsakeDemo.Tests\bin\Debug\PsakeDemo.Tests.dll
}
# psake Test -parameters "@{'env'='dev';'tests'='Acceptance'}"
Task Clean {
msbuild $buildFileName /t:Clean
}
Task Deploy -Depends Build -precondition { return $env }{
"Deploying $environment"
}
Task FailureTask {
#use cmd.exe and the DOS exit() function to simulate a failed command-line execution
"Executing command-line program"
cmd /c exit (1)
CheckForError("Failure Task")
}
function CheckForError($task) {
if ($lastexitcode -ne 0)
{
throw "$task failed"
}
}