5
5
# Must match parameter definitions for psake.psm1/invoke-psake
6
6
# otherwise named parameter binding fails
7
7
param (
8
- [Parameter (Position = 0 , Mandatory = 0 )]
9
- [string ]$buildFile = ' default.ps1' ,
10
- [Parameter (Position = 1 , Mandatory = 0 )]
11
- [string []]$taskList = @ (),
12
- [Parameter (Position = 2 , Mandatory = 0 )]
13
- [string ]$framework ,
14
- [Parameter (Position = 3 , Mandatory = 0 )]
15
- [switch ]$docs = $false ,
16
- [Parameter (Position = 4 , Mandatory = 0 )]
17
- [System.Collections.Hashtable ]$parameters = @ {},
18
- [Parameter (Position = 5 , Mandatory = 0 )]
19
- [System.Collections.Hashtable ]$properties = @ {},
20
- [Parameter (Position = 6 , Mandatory = 0 )]
21
- [string ]$scriptPath = $ (Split-Path - parent $MyInvocation.MyCommand.path ),
22
- [Parameter (Position = 7 , Mandatory = 0 )]
23
- [switch ]$nologo = $false
8
+ [Parameter (Position = 0 , Mandatory = 0 )]
9
+ [string ]$buildFile = ' default.ps1' ,
10
+ [Parameter (Position = 1 , Mandatory = 0 )]
11
+ [string []]$taskList = @ (),
12
+ [Parameter (Position = 2 , Mandatory = 0 )]
13
+ [string ]$framework ,
14
+ [Parameter (Position = 3 , Mandatory = 0 )]
15
+ [switch ]$docs = $false ,
16
+ [Parameter (Position = 4 , Mandatory = 0 )]
17
+ [System.Collections.Hashtable ]$parameters = @ {},
18
+ [Parameter (Position = 5 , Mandatory = 0 )]
19
+ [System.Collections.Hashtable ]$properties = @ {},
20
+ [Parameter (Position = 6 , Mandatory = 0 )]
21
+ [alias (" init" )]
22
+ [scriptblock ]$initialization = {},
23
+ [Parameter (Position = 7 , Mandatory = 0 )]
24
+ [switch ]$nologo = $false ,
25
+ [Parameter (Position = 8 , Mandatory = 0 )]
26
+ [switch ]$help = $false ,
27
+ [Parameter (Position = 9 , Mandatory = 0 )]
28
+ [string ]$scriptPath = $ (Split-Path - parent $MyInvocation.MyCommand.path )
24
29
)
25
30
26
- remove-module psake - ea ' SilentlyContinue'
31
+ # '[p]sake' is the same as 'psake' but $Error is not polluted
32
+ remove-module [p ]sake
27
33
import-module (join-path $scriptPath psake.psm1)
28
- if (-not (test-path $buildFile ))
29
- {
34
+ if ($help ) {
35
+ Get-Help Invoke-psake - full
36
+ return
37
+ }
38
+
39
+ if (-not (test-path $buildFile )) {
30
40
$absoluteBuildFile = (join-path $scriptPath $buildFile )
31
- if (test-path $absoluteBuildFile )
32
- {
33
- $buildFile = $absoluteBuildFile
34
- }
41
+ if (test-path $absoluteBuildFile ) {
42
+ $buildFile = $absoluteBuildFile
43
+ }
35
44
}
36
- invoke-psake $buildFile $taskList $framework $docs $parameters $properties $nologo
37
- exit $lastexitcode
45
+
46
+ invoke-psake $buildFile $taskList $framework $docs $parameters $properties $initialization $nologo
0 commit comments