-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.ps1
41 lines (34 loc) · 2.32 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
[cmdletbinding()]
param(
$task = 'default'
)
# BootStrap nuget packageprovider
write-debug $PSScriptRoot
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
$ModuleRequrementsPath = Join-Path -Path $PSScriptRoot -ChildPath "requirements.psd1"
Write-Debug "ModuleRequirementsPath = $ModuleRequrementsPath"
$MustRequiredModule = @(
@{name = 'psdepend' }
# @{name = 'psake' }
# @{name = 'pester'; MinimumVersion = 4.1 ; SkipPublisherCheck = $true }
)
$MustRequiredModule | ForEach-Object {
if (Get-Module -Name $_.name -ListAvailable) {
} else {
Install-Module @_ -force -AllowClobber -Scope 'CurrentUser'
}
# Import the module
Import-Module $_.name
}
if (Test-Path -Path $ModuleRequrementsPath) {
Write-Debug "install depends"
Invoke-PSDepend -Path $ModuleRequrementsPath -Install -Import -Force -WarningAction SilentlyContinue
}
if ($task) {
if (test-path "$PSScriptRoot\psake.ps1") {
Write-Debug "run task $task"
Invoke-psake -buildFile "$PSScriptRoot\psake.ps1" -taskList $task
} else {
Write-Error "$PSScriptRoot\psake.ps1 Not Found"
}
}