This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.ps1
91 lines (67 loc) · 2.13 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
$root = Split-Path $MyInvocation.MyCommand.Path -Parent
Write-Host "root=$root"
properties {
if ($env:ChocolateyLocal -and (Test-Path $env:ChocolateyLocal)) {
$outDir = $env:ChocolateyLocal
} else {
$outDir = Join-Path $env:LOCALAPPDATA 'Accelerator'
if (-not(Test-Path $outDir)) {
New-Item $outDir -Type Directory | Out-Null
}
}
$psVersion = 0
$chocoOutDir = $outDir
$chocoPkgsDir = $root
$acceleratorNewWindow = $false
$acceleratorCommand = $null
$acceleratorFunction = $null
$acceleratorParams = @{}
}
if (Test-Path "$($root)\psake-local.ps1") {
include "$($root)\psake-local.ps1"
}
include '.\Modules\Psake-Choco\psake-tasks.ps1'
properties {
$acceleratorScript = "$($root)\Accelerator.ps1"
}
task SetAcceleratorPath {
if ($acceleratorPath) {
$env:AcceleratorPath = $acceleratorPath
} else {
$env:AcceleratorPath = "$(Split-Path $PROFILE -Parent)"
}
}
task SetAcceleratorInteractive {
$env:AcceleratorInteractive = $true
}
task RunAccelerator {
Write-Host "PowerShell v$($PSVersionTable.PSVersion)"
if ($psVersion -gt 0) {
$acceleratorNewWindow = $true
$acceleratorParams['PowerShellVersion'] = $psVersion
}
if ($acceleratorNewWindow) {
$acceleratorParams['UseStart'] = $true
}
if ($env:AcceleratorInteractive) {
$acceleratorParams['Interactive'] = $true
$acceleratorParams['Confirm'] = $true
}
if ($acceleratorCommand) {
$acceleratorParams['CommandName'] = $acceleratorCommand
}
if ($acceleratorFunction) {
$acceleratorParams | ForEach-Object { &$acceleratorFunction }
} else {
& $acceleratorScript @acceleratorParams
}
}
task Run -depends SetAcceleratorPath,SetAcceleratorInteractive,RunAccelerator
task RunNoUI -depends SetAcceleratorPath,RunAccelerator
task Prompt -depends SetAcceleratorPath {
powershell -Version 2 -NoProfile
}
task Build -depends Choco:BuildPackages
## Currently this would push all nupkg files in the output directory
task Deploy -depends Choco:DeployPackages
task Default -depends Run