A few announcements… First the big one. Many people have been using psake – both the PowerShell 1.0- and 2.0-compatible versions – in production without any significant issues. For that reason, we have released psake v1.00 (compatible with PowerShell 1.0). The only difference between psake v1.00 and psake v0.23 is the version number. My friend, Ayende, has a great example of converting Rhino Mocks build to use psake.
We have released psake v2.01 (compatible with PowerShell 2.0). (This was formerly called psake v0.24, “Jorge”, and psake-ps2.) A big thanks to Jorge Matos for all his work on psake v2.01.
A few minor changes… The source code for psake has been moved to GitHub and the SVN repository at Google Code has been retired. We will still be using Google Code for bug tracking, wiki pages, etc. If you want the latest source code, you can always download a zip file for master (aka trunk in SVN terms) – or any tags/branches – from:
Note that there is no need to install Git to download the latest package as GitHub will create the appropriate zip file on the fly.
If you have some great idea, you can download the git repo from git://github.com/JamesKovacs/psake.git or http://github.com/JamesKovacs/psake.git. (msysgit is the Git package of choice for Windows. You can download it from http://code.google.com/p/msysgit/.) I would encourage you to read Jeremy Skinner’s excellent guide for contributing to MvcContrib via GitHub. Just mentally replace “MvcContrib” with “psake”, though I’d encourage you to contribute to MvcContrib too.
I would like to offer lots of kudos to my collaborators/conspirators on the project. Jorge Matos has been instrumental in updating/improving psake to use the new PowerShell v2 features. Thanks to Shaun Becker for patches and answering newsgroup questions. And thanks to Eric Hexter for his assistance in moderating the psake-users Google Group. I am heartened and thankful for the willing collaboration on this project and am excited to watch it grow. If you have any questions, please do not hesitate to ask.
Going forward, we are retiring psake v1.00 and focusing on psake v2.00. If there is demand for a PowerShell v1-compatible version of psake, we will create a branch based on the v1.00 tag, but we will mostly be focused on the PowerShell v2-compatible version (aka psake v2.00). So your next question probably is…
What’s New in psake v2.01?
(from Jorge Matos)
The main difference is that psake v2.01 has been re-written as a module that contains advanced functions. Someone using the module could either run the import-module command with the path to the module file (i.e. import-module .\psake.psm1) or (my preference) you can copy the psake.psm1 into a folder called psake into the “Modules” folder in your profile directory (you may have to create it if it’s not there) or your machine-wide “Modules” directory:
i.e. Profile Directory:
i.e. Machine-wide Modules folder:
Once the psake folder is created and you’ve copied the psake.psm1 file into it – restart PS and type “import-module psake” – PS will find the module and load it automatically. What I’ve done is add the “Import-Module psake” to my profile script so that it is loaded everytime I startup PS.
- Build scripts don’t need to know where psake is installed, they just call Invoke-psake and it works.
- Encapsulation… Global variables are no longer required since they can be private to a module unless explicitly exported (I haven’t gotten around to actually changing the psake code to not use global variables yet).
- Modules can be unloaded if needed which removes all the code and variables from memory.
The other big difference is that the “Invoke-psake” and “Task” functions have been converted into Advanced Functions which basically means you can take advantage of comment help which means you can type help invoke-psake and you will get back real help with examples.
- Coding style is different.
- Try/Catch is used instead of the “Trap” statement.
- Got rid of the “exec” function.
- You can now define “Pre” and “Post” actions for a task.
- You can define how the task name will be formatted.
- You can define a “TaskSetup” function that will be executed before every task (took that from NUnit).
- You can define a “TaskTearDown” function that will be executed after every task (took that from NUnit too).
- Create a global variable called “psake_buildSucceeded” that will be set to true if the build succeeds – scripts can check this.
- Also added a “$noexit” switch to Run-Psake so that the function will not use the exit() function so that you can test a build script at the command line without PS closing down (the default behavior when the build fails is to call exit(1) so that the calling code can determine if the build failed or not).
- The psake-buildTester.ps1 had to be changed slightly in order for it to call the Invoke-psake function.
- Added more examples in the .\examples folder for POST conditions, PRE and POST Actions, etc.
Happy (build) scripting!