Updated psake

267 views
Skip to first unread message

Jorge Matos

unread,
Feb 9, 2010, 10:46:21 PM2/9/10
to psak...@googlegroups.com, psake...@googlegroups.com
Now psake has support for passing parameters to build scripts.
 
Please get the latest version and let me know what you all think.
 
Example:
 
Invoke-psake .\parameters.ps1 -parameters @{"p1"="v1";"p2"="v2"}
 
parameters.ps1
--------------------
properties {
 $p1 = $null
 $p2 = $null
}
 
task default -depends TestParams
 
task TestParams {
  Assert ($p1 -ne $null) "p1 should not be null"
  Assert ($p2 -ne $null) "p2 should not be null"
}

James Allen

unread,
Feb 10, 2010, 9:42:20 AM2/10/10
to psake-users
Fantastic, a really useful feature. PSake rules, so glad to get rid of
NAnt. I'm using this new feature to pass in 'environment' and
'verbosity' parameters:

properties {
$environment = "development"
$verbosity = "normal" #quiet, minimal, normal, detailed
}

task BuildAndPublish -depends SetConfigFilesForEnvironment, Build,
Publish
{

}

task SetConfigFilesForEnvironment
{
if($environment -eq "live")
#Do something...
ElseIf($environment -eq "staging")
#Something else...
}

task Build -depends Clean, GenerateAssemblyInfo {
Write-Host "Building for $environment environment with verbosity
$verbosity"
msbuild /version #Display msbuild version
msbuild "/p:OutDir=$build_dir\" "/verbosity:$verbosity" $sln_file
}

Invoke-psake .\psake-build.ps1 BuildAndPublish -parameters
@{"environment"="staging", "verbosity"="quiet"}

Reply all
Reply to author
Forward
0 new messages