forked from linus123/TinyReturns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.ps1
97 lines (68 loc) · 3.07 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
properties {
Framework '4.0'
$projectName = "TinyReturns"
$baseDir = resolve-path .
$buildConfig = "Release"
$databaseChangeOwner = "Paul Herrera"
$buildFolder = "$baseDir\package"
$srcFolder = "$baseDir\src"
$docsFolder = "$baseDir\docs"
$buildTargetFolder = "$buildFolder\$buildConfig"
$databaseServer = "(local)\sqlexpress"
$databaseName = $projectName
$standardDatabaseObjectsFolder = "$baseDir\data\mssql\StandardObjects"
$databaseScripts = "$baseDir\data\mssql\TinyReturns\TransitionsScripts"
$dbdeployExec = "$baseDir\lib\dbdeploy\dbdeploy.exe"
$doDatabaseScriptPath = "$buildFolder\DatabaseUpgrade_GIPS_Local_$dateStamp.sql"
$undoDatabaseScriptPath = "$buildFolder\DatabaseRollback_GIPS_Local_$dateStamp.sql"
$solutionFile = "$srcFolder\TinyReturns.sln"
$packageNunitExec = "$srcFolder\packages\xunit.runners.1.9.2\tools\xunit.console.clr4.exe"
}
task default -depends CleanSolution, BuildSolution, RebuildDatabase, RunUnitTests, RunIntegrationTests, PopulateDatabase
formatTaskName {
param($taskName)
write-host "********************** $taskName **********************" -foregroundcolor Green
}
task CleanSolution {
if (Test-Path $buildFolder) {
rd $buildFolder -rec -force | out-null
}
mkdir $buildFolder | out-null
Exec { msbuild "$solutionFile" /t:Clean /p:Configuration=$buildConfig /v:quiet }
}
task BuildSolution -depends CleanSolution {
Exec { msbuild "$solutionFile" /t:Build /p:Configuration=Release /v:quiet /p:OutDir="$buildTargetFolder\" }
Copy-Item "$srcFolder\Logging\Log4NetConfig.xml" "$buildTargetFolder"
}
task RebuildDatabase {
DropSqlDatabase $databaseServer $databaseName
CreateSqlDatabase $databaseServer $databaseName
RunDatabaseScriptsFromFolder $databaseServer $databaseName $standardDatabaseObjectsFolder
Exec { &$dbDeployExec `
-scriptfiles $databaseScripts `
-dofile $doDatabaseScriptPath `
-undofile $undoDatabaseScriptPath `
-connection "Initial Catalog=$databaseName;Data Source=$databaseServer;Integrated Security=SSPI;" `
-type mssql `
-deltaset "$projectName" `
-tablename DatabaseVersion `
-owner $databaseChangeOwner
}
ExecuteSqlFile $databaseServer $databaseName $doDatabaseScriptPath
}
task RunUnitTests -depends BuildSolution {
Exec { &$packageNunitExec "$buildTargetFolder\Dimensional.TinyReturns.UnitTests.dll" /html "$buildFolder\Dimensional.TinyReturns.UnitTests.dll.html" }
}
task RunIntegrationTests -depends BuildSolution {
Exec { &$packageNunitExec "$buildTargetFolder\Dimensional.TinyReturns.IntegrationTests.dll" /html "$buildFolder\Dimensional.TinyReturns.IntegrationTests.dll.html" }
}
task PopulateDatabase -depends RebuildDatabase {
$consoleExec = "$buildTargetFolder\Dimensional.TinyReturns.CitiFileImporterConsole.exe"
$netOfFeesFile = "$docsFolder\CitiFileFullNetOfFees.csv"
$grossOfFeesFile = "$docsFolder\CitiFileFullGrossOfFees.csv"
$indexFile = "$docsFolder\CitiFileFullIndex.csv"
Write-Host "Executing: $consoleExec $netOfFeesFile $grossOfFeesFile $indexFile"
cd "$buildTargetFolder"
Exec { &$consoleExec "$netOfFeesFile" "$grossOfFeesFile" "$indexFile" }
cd "$baseDir"
}