Permalink
Browse files

Merge branch 'master' of github.com:psake/psake

  • Loading branch information...
JamesKovacs committed Oct 11, 2011
2 parents 68b4902 + 62c54db commit 42eb994078225023ca211057d262c55f3d9bff85
View
@@ -77,8 +77,8 @@
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="2">
<maml:name>framework</maml:name>
<maml:description>
- <maml:para>The version of the .NET framework you want to build. You can append x86 or x64 to force a specific framework. If not specified, x86 or x64 will be detected based on the bitness of the PowerShell process.
-Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x64', '3.5', '3.5x86', '3.5x64', '4.0', '4.0x86', '4.0x6'</maml:para>
+ <maml:para>The version of the .NET framework you want to use during build. You can append x86 or x64 to force a specific framework. If not specified, x86 or x64 will be detected based on the bitness of the PowerShell process.
+Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x64', '3.5', '3.5x86', '3.5x64', '4.0', '4.0x86', '4.0x64'</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">String</command:parameterValue>
<dev:type>
@@ -167,19 +167,22 @@ Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x
<maml:title></maml:title>
<maml:alert>
<maml:para>---- Exceptions ----</maml:para>
- <maml:para>If there is an exception thrown during the running of a build script and the build script was invoked by a windows service then psake will execute the "exit" command (with a default value of "1") which in turn sets the PowerShell $lastexitcode variable otherwise psake will set the '$psake.build_success' variable to $true or $false depending on whether an exception was thrown.</maml:para>
+ <maml:para>If there is an exception thrown during the running of a build script psake will set the '$psake.build_success' variable to $false. To detect failue outside PowerShell (for example by build server), finish PowerShell process with non-zero exit code when '$psake.build_success' is $false. Calling psake from 'cmd.exe' with 'psake.cmd' will give you that behaviour.</maml:para>
<maml:para></maml:para>
</maml:alert>
<maml:alert>
<maml:para>---- $psake variable ----</maml:para>
<maml:para>When the psake module is loaded a variable called $psake is created which is a hashtable
-containing some variables that can be used to configure psake:
+containing some variables:
-$psake.build_success = $false # indicates that the current build was successful
-$psake.version = "4.2" # contains the current version of psake
-$psake.build_script_file = $null # contains a System.IO.FileInfo for the current build file
-$psake.build_script_dir # contains the fully qualified path to the current build file
-$psake.framework_version = "" # contains the framework version # for the current build
+$psake.version # contains the current version of psake
+$psake.context # holds onto the current state of all variables
+$psake.run_by_psake_build_tester # indicates that build is being run by psake-BuildTester
+$psake.config_default # contains default configuration
+ # can be overriden in psake-config.ps1 in directory with psake.psm1 or in directory with current build script
+$psake.build_success # indicates that the current build was successful
+$psake.build_script_file # contains a System.IO.FileInfo for the current build script
+$psake.build_script_dir # contains the fully qualified path to the current build script
You should see the following when you display the contents of the $psake variable right after importing psake
@@ -188,13 +191,15 @@ PS projects:\psake> $psake
Name Value
---- -----
+run_by_psake_build_tester False
version 4.2
+build_success False
build_script_file
build_script_dir
-build_success False
-framework_version
+config_default @{framework=3.5; ...
+context {}
-After a build is executed the following $psake values are updated (build_script_file, build_script_dir, build_success, and framework_version)
+After a build is executed the following $psake values are updated: build_script_file, build_script_dir, build_success
PS projects:\psake> Invoke-psake .\examples\default.ps1
Executing task: Clean
@@ -220,11 +225,14 @@ PS projects:\psake> $psake
Name Value
---- -----
+build_script_file YOUR_PATH\examples\default.ps1
+run_by_psake_build_tester False
+build_script_dir YOUR_PATH\examples
+context {}
version 4.2
-build_script_file C:\Users\Jorge\Documents\Projects\psake\examples\default.ps1
-build_script_dir C:\Users\Jorge\Documents\Projects\psake\examples
build_success True
-framework_version 3.5
+config_default @{framework=3.5; ...
+
</maml:para>
<maml:para></maml:para>
</maml:alert>
@@ -426,6 +434,10 @@ task TestProperties {
<maml:navigationLink>
<maml:linkText>Assert</maml:linkText>
<maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
@@ -573,6 +585,10 @@ Build Succeeded</maml:para>
<maml:navigationLink>
<maml:linkText>Assert</maml:linkText>
<maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
@@ -720,10 +736,145 @@ Build Succeeded</maml:para>
<maml:navigationLink>
<maml:linkText>Assert</maml:linkText>
<maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
+ <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
+ <command:details>
+ <command:name>Framework</command:name>
+ <maml:description>
+ <maml:para>Sets the version of the .NET framework you want to use during build.</maml:para>
+ </maml:description>
+ <maml:copyright>
+ <maml:para />
+ </maml:copyright>
+ <command:verb></command:verb>
+ <command:noun></command:noun>
+ <dev:version />
+ </command:details>
+ <maml:description>
+ <maml:para>This function will accept a string containing version of the .NET framework to use during build. Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x64', '3.5', '3.5x86', '3.5x64', '4.0', '4.0x86', '4.0x64'. Default is '3.5*', where x86 or x64 will be detected based on the bitness of the PowerShell process.</maml:para>
+ </maml:description>
+ <command:syntax>
+ <command:syntaxItem>
+ <command:name>Framework</command:name>
+ <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0">
+ <maml:name>framework</maml:name>
+ <command:parameterValue required="true" variableLength="false">string</command:parameterValue>
+ </command:parameter>
+ </command:syntaxItem>
+ </command:syntax>
+ <command:parameters>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0">
+ <maml:name>framework</maml:name>
+ <maml:description>
+ <maml:para>Version of the .NET framework to use during build.</maml:para>
+ </maml:description>
+ <command:parameterValue required="true" variableLength="false">string</command:parameterValue>
+ <dev:type>
+ <maml:name>string</maml:name>
+ <maml:uri />
+ </dev:type>
+ <dev:defaultValue></dev:defaultValue>
+ </command:parameter>
+ </command:parameters>
+ <command:inputTypes>
+ <command:inputType>
+ <dev:type>
+ <maml:name>None</maml:name>
+ <maml:uri />
+ <maml:description>
+ <maml:para />
+ </maml:description>
+ </dev:type>
+ <maml:description />
+ </command:inputType>
+ </command:inputTypes>
+ <command:returnValues>
+ <command:returnValue>
+ <dev:type>
+ <maml:name>None</maml:name>
+ <maml:uri />
+ <maml:description>
+ <maml:para></maml:para>
+ </maml:description>
+ </dev:type>
+ <maml:description />
+ </command:returnValue>
+ </command:returnValues>
+ <command:terminatingErrors />
+ <command:nonTerminatingErrors />
+ <maml:alertSet>
+ <maml:title></maml:title>
+ <maml:alert>
+ <maml:para></maml:para>
+ </maml:alert>
+ </maml:alertSet>
+ <command:examples>
+ <command:example>
+ <maml:title>-------------- EXAMPLE 1 --------------</maml:title>
+ <dev:code>
+Framework "4.0"
+
+Task default -depends Compile
+
+Task Compile -depends Clean {
+ msbuild /version
+}</dev:code>
+ <dev:remarks>
+ <maml:para>Description</maml:para>
+ <maml:para>-----------</maml:para>
+ <maml:para>The script above will output detailed version of msbuid v4</maml:para>
+ <maml:para />
+ </dev:remarks>
+ <command:commandLines>
+ <command:commandLine>
+ <command:commandText />
+ </command:commandLine>
+ </command:commandLines>
+ </command:example>
+ </command:examples>
+ <maml:relatedLinks>
+ <maml:navigationLink>
+ <maml:linkText>Task</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Include</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Properties</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Invoke-psake</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>FormatTaskName</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>TaskSetup</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>TaskTearDown</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Assert</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
+ </maml:relatedLinks>
+ </command:command>
+
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<command:details>
<command:name>FormatTaskName</command:name>
@@ -905,6 +1056,10 @@ Task TaskC {
<maml:navigationLink>
<maml:linkText>Assert</maml:linkText>
<maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
@@ -1042,6 +1197,10 @@ Task Clean {
<maml:navigationLink>
<maml:linkText>Assert</maml:linkText>
<maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
@@ -1184,6 +1343,10 @@ Task Clean {
<maml:navigationLink>
<maml:linkText>Assert</maml:linkText>
<maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
@@ -1484,6 +1647,10 @@ Total: 00:00:00.0782496</dev:code>
<maml:navigationLink>
<maml:linkText>Assert</maml:linkText>
<maml:uri />
+ </maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
@@ -1657,6 +1824,10 @@ The solution is to wrap the condition in () so that PS will evaluate it first.
<maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
@@ -1800,6 +1971,10 @@ The solution is to wrap the condition in () so that PS will evaluate it first.
<maml:uri />
</maml:navigationLink>
</maml:relatedLinks>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
@@ -1930,6 +2105,10 @@ The solution is to wrap the condition in () so that PS will evaluate it first.
<maml:linkText>TaskTearDown</maml:linkText>
<maml:uri />
</maml:navigationLink>
+ <maml:navigationLink>
+ <maml:linkText>Framework</maml:linkText>
+ <maml:uri />
+ </maml:navigationLink>
</maml:relatedLinks>
</command:command>
</helpItems>
@@ -1,34 +1,33 @@
Properties {
- $x = 1
- $y = 2
+ $x = 1
+ $y = 2
}
FormatTaskName "[{0}]"
Task default -Depends Verify
-Task Verify -Description "This task verifies psake's variables" {
-
- $assertions = @(
- ((Test-Path 'variable:\psake'), "'psake' variable was not exported from module"),
- (($variable:psake.ContainsKey("build_success")), "psake variable does not contain 'build_success'"),
- (($variable:psake.ContainsKey("version")), "psake variable does not contain 'version'"),
- (($variable:psake.ContainsKey("build_script_file")), "psake variable does not contain 'build_script_file'"),
- (($variable:psake.ContainsKey("framework_version")), "psake variable does not contain 'framework_version'"),
- ((!$variable:psake.build_success), 'psake.build_success should be $false'),
- ((![string]::IsNullOrEmpty($variable:psake.version)), 'psake.version was null or empty'),
- (($variable:psake.build_script_file -ne $null), '$psake.build_script_file was null'),
- (($variable:psake.build_script_file.Name -eq "checkvariables.ps1"), ("psake variable: {0} was not equal to 'VerifyVariables.ps1'" -f $psake.build_script_file.Name)),
- ((![string]::IsNullOrEmpty($variable:psake.framework_version)), 'psake variable: $psake.framework_version was null or empty'),
- (($variable:psake.context.Peek().tasks.Count -ne 0), 'psake variable: $tasks had length zero'),
- (($variable:psake.context.Peek().properties.Count -ne 0), 'psake variable: $properties had length zero'),
- (($variable:psake.context.Peek().includes.Count -eq 0), 'psake variable: $includes should have had length zero'),
- (($variable:psake.context.Peek().formatTaskNameString -ne ""), 'psake variable: $formatTaskNameString was not set correctly'),
- (($variable:psake.context.Peek().currentTaskName -eq "Verify"), 'psake variable: $currentTaskName was not set correctly')
- )
-
- foreach ($assertion in $assertions)
- {
- Assert ( $assertion[0] ) $assertion[1]
- }
+Task Verify -Description "This task verifies psake's variables" {
+
+ Assert (Test-Path 'variable:\psake') "psake variable was not exported from module"
+
+ Assert ($psake.ContainsKey("version")) "psake variable does not contain 'version'"
+ Assert ($psake.ContainsKey("context")) "psake variable does not contain 'context'"
+ Assert ($psake.ContainsKey("build_success")) "psake variable does not contain 'build_success'"
+ Assert ($psake.ContainsKey("build_script_file")) "psake variable does not contain 'build_script_file'"
+ Assert ($psake.ContainsKey("build_script_dir")) "psake variable does not contain 'build_script_dir'"
+
+ Assert (![string]::IsNullOrEmpty($psake.version)) '$psake.version was null or empty'
+ Assert ($psake.context -ne $null) '$psake.context was null'
+ Assert (!$psake.build_success) '$psake.build_success should be $false'
+ Assert ($psake.build_script_file -ne $null) '$psake.build_script_file was null'
+ Assert ($psake.build_script_file.Name -eq "checkvariables.ps1") ("psake variable: {0} was not equal to 'checkvariables.ps1'" -f $psake.build_script_file.Name)
+ Assert (![string]::IsNullOrEmpty($psake.build_script_dir)) '$psake.build_script_dir was null or empty'
+
+ Assert ($psake.context.Peek().tasks.Count -ne 0) "psake context variable 'tasks' had length zero"
+ Assert ($psake.context.Peek().properties.Count -ne 0) "psake context variable 'properties' had length zero"
+ Assert ($psake.context.Peek().includes.Count -eq 0) "psake context variable 'includes' should have had length zero"
+ Assert ($psake.context.Peek().config -ne $null) "psake context variable 'config' was null"
+
+ Assert ($psake.context.Peek().currentTaskName -eq "Verify") 'psake variable: $currentTaskName was not set correctly'
}
View
@@ -0,0 +1,8 @@
+Framework "4.0"
+# Framework "4.0x64"
+
+task default -depends ShowMsBuildVersion
+
+task ShowMsBuildVersion {
+ msbuild /version
+}
Oops, something went wrong.

0 comments on commit 42eb994

Please sign in to comment.