-
Notifications
You must be signed in to change notification settings - Fork 2
/
Build.ps1
58 lines (52 loc) · 1.95 KB
/
Build.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
[cmdletbinding(DefaultParameterSetName = 'Task')]
param(
[parameter(ParameterSetName = 'task', position = 0)]
[System.String[]]$Tasks = 'Default',
[parameter(ParameterSetName = 'task')]
[System.String]$DeployType = 'DEV',
[parameter(ParameterSetName = 'Help')]
[switch]$Help
)
Clear-Host
if (-not (Get-Module -Name PSDepend -ListAvailable)) {
Write-Verbose "[BUILD] Install module dependecies"
Get-PackageProvider -Name Nuget -ForceBootstrap | Out-Null
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-module -Name PSDepend -Repository PSGallery -Scope CurrentUser
Import-Module -Name PSDepend -Verbose:$false
Invoke-PSDepend -Path './requirements.psd1' -Install -Import -Force -WarningAction SilentlyContinue
Write-Verbose "[BUILD] Install module dependecies done"
} else {
Write-Verbose "[BUILD] Dependencies allready installed"
}
Write-Verbose "[BUILD] Execute psake task"
$psakefile = './Build/Module.Build.ps1'
if ($PSCmdlet.ParameterSetName -eq 'Help') {
Get-PSakeScriptTasks -buildFile $psakeFile |
Format-Table -Property Name, Description, Alias, DependsOn
} else {
$PSakeParams = @{
BuildFile = $psakefile
nologo = $true
}
if ($PSBoundParameters['verbose']) {
$PSakeParams.add('verbose', $verbose)
}
if ($Tasks -eq "Deploy") {
Invoke-psake @PSakeParams -taskList Deploy -parameters @{'DeployType' = $DeployType }
exit ( [int]( -not $psake.build_success ) )
} else {
Invoke-psake @PSakeParams -taskList $Tasks
exit ( [int]( -not $psake.build_success ) )
}
}
#invoke-psake -buildFile .\Build\Module.Build.ps1 -taskList Deploy -Verbose -parameters @{'DeployType' = 'PROD' }
<# $PSakeParams = @{
BuildFile = $psakefile
nologo = $true
}
if ($PSBoundParameters['verbose']) {
$PSakeParams.add('verbose', $verbose)
}
Invoke-psake @PSakeParams -taskList $Tasks
exit ( [int]( -not $psake.build_success ) ) #>