This repository was archived by the owner on Jan 14, 2025. It is now read-only.
forked from kunzimariano/VersionOne.Build.Common
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.ps1
More file actions
46 lines (40 loc) · 1.2 KB
/
setup.ps1
File metadata and controls
46 lines (40 loc) · 1.2 KB
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
param(
[alias("t")]
[string] $tasks = ''
)
function GetModulePath([string]$module){
$commonPath = @(Get-ChildItem -r -Path packages -filter $module | Sort-Object FullName -descending)
return $commonPath[0].FullName
}
function DownloadNuget(){
new-item (Get-Location).Path -name .nuget -type directory -force
$destination = (Get-Location).Path + '\.nuget\nuget.exe'
Invoke-WebRequest -Uri "http://nuget.org/nuget.exe" -OutFile $destination
}
function DownloadAndImportModules(){
.nuget\nuget.exe install psake -OutputDirectory packages -NoCache
.nuget\nuget.exe install VersionOne.Build.Common -Source http://www.myget.org/F/versionone/api/v2/ -OutputDirectory packages -NoCache
}
function CopyCommonToRoot(){
$commonPath = GetModulePath "VersionOne.Build.Common.ps1"
Copy-Item -Path $commonPath -Destination (Get-Location).Path -Force
}
function ImportPsake(){
$psakePath = GetModulePath "psake.psm1"
Import-Module $psakePath
}
try{
DownloadNuget
DownloadAndImportModules
ImportPsake
CopyCommonToRoot
Invoke-psake VersionOne.Build.Common.ps1 ($tasks.Split(',').Trim())
}
Catch {
throw "Build failed."
}
Finally {
if ($psake.build_success -eq $false) {
throw "Build failed."
}
}