Long time ago (link) I’ve created a little helper function to ease creation of PowerShell modules. Since then I’ve learnt a lot of new stuff, but most importantly I’ve met Plaster. I’ve decided to revisit the idea of scaffolding a PowerShell module with Plaster.
I’m using this template for some time now, but never found time to publish it. If You’ve been to our Polish PowerShell User Group #10 Meetup, You could get a sneak peak of it being used in our CI/CD chain both for open source (AppVeyor and GitHub) and closed source (TeamCity in Objectivity). We (with Tomek Dabrowski) had the privilege to show that during PSConfEU 2018 (YouTube and slides ) as well.
What is the benefit of using Plaster? Simplicity and repeatability when creating new modules. It can also be used to create functions and tests files based on another template (that is yet to be discovered by me :)) ) If you’d like to know more, these are the best sources to start from:
- Kevin Marquette - Powershell: Adventures in Plaster and Powershell: GetPlastered, a Plaster template to create a Plaster template
- Mike F Robbins - Using Plaster to create a PowerShell Script Module template and PowerShell Script Module Design: Plaster Template for Creating Modules
- David Christian - Working with Plaster (YouTube) and Working with Plaster (blog)
Our PPoShTemplate creates basic folder structure, script style rules for PSScriptAnalyzer and adds build scripts to support both local runs and with CI/CD (works well with TeamCity and AppVeyor). The bonus is that if you clone your repo’s wiki it will regenerate it during local build run (details in our video from PSConfEU).
How to Use it
This is VERY simple - just download/clone this repo PlasterModuleTemplate and Invoke-Plaster
This will trigger Plaster. After you answer some questions your new module will be created:
Currently we’re preparing to add Azure DevOps Services (a.k.a VSTS) into the mix, so soon additional files in build directory will be added to support that.