You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to start a thread here where folks can see our initial list of use cases. Propose others for debate and eventually wind up with a set of supported use cases for the initial release. Here is the set of use cases I have been working off of for the preview.
Create files for the user.
This may be an empty PSM1 file or an about_${ModuleName}.help.txt file with some boiler plate text in it or a module manifest file filled in with information gathered from the user.
Create folders where necessary to provide required (or desired) structure.
For instance, projects targeting VSCode that supply tasks.json file need to put that file in a .vscode directory and if that directory doesn't exist, it needs to be created. Similarly a module manifest Pester test might go in a Tests folder.
Modify existing files.
Templates are just for initial project scaffolding. You can use them throughout project (module/dsc resource) development to: Add a new DSC resource or add PSake build support to a pre-existing module. Some additions might require modifications to existing files, like adding a new task to the VSCode tasks.json file.
I know some folks have wanted arbitrary code execution. This is something we're currently going out of our way to prevent. We want users who are expecting "scaffolding" i.e. the creation of files & folders, to be able to trust that the template isn't do something else. In fact, I haven't implemented it yet but I'd like for a user to be able to trust that the template will not modify anything outside of the DestinationPath they've specified. That said, if there are important use cases we're giving up, I'd like to know.
Discussed this with @gaelcolas the other day. One might imagine a situation where they could read a documented API (or even a config file they create) and dynamically generate a set of functions from those at module creation time.
Not a hugely common use case, but just one example among others of where code execution would be beneficial.
On the risks:
It would seem there are fewer vectors for injection attacks for this tool. Hypothetically, sure, someone might send you an evil template of sorts. That seems like a corner case.
It might be reasonable to offer something to enable or disable execution of scripts, similar to how you can call PowerShell with -NoProfile. Maybe off by default with -EnableExecution, or on by default with -DisableExecution, or something along those lines
Gotta get to work, but again, love this project, looking forward to seeing it grow!
I think being able to create a folder/file structure based on a template and giving the user access to special variables that auto fill into the files would go a very long way. I even think you should give the user the ability to create their own variables for their own custom style projects.
I have been sick the last few days, so I have not gotten to really play with Plaster, and I'm still reading over everything, so I am a bit behind.
I have been thinking a little bit about use cases, and trying to get into the mode of thinking outside of the box. A few examples that I see being interesting:
Demo\Presentation Scaffolding
Reports
Forms
SCCM/Package Deployment Scaffolding for things like PSAppDeployToolkit or similar. (Already use something like this in production)
VSCode Editor Commands
Teaching\Helping users learn how to use new concepts. Instead of your typical parameters, you name them as steps and have the user select additional parameters as they learn more about the topic, each step has new guidance on new aspects of the topic. It lets the user gradually layer on new things in a manageable way while getting guidance each step of the way.
chocolatey package scaffolding
I think there were some others that I am forgetting, but I'll try to add those as I remember them.
Activity
RamblingCookieMonster commentedon May 20, 2016
Hi!
Discussed this with @gaelcolas the other day. One might imagine a situation where they could read a documented API (or even a config file they create) and dynamically generate a set of functions from those at module creation time.
Not a hugely common use case, but just one example among others of where code execution would be beneficial.
On the risks:
Gotta get to work, but again, love this project, looking forward to seeing it grow!
gerane commentedon May 20, 2016
I think being able to create a folder/file structure based on a template and giving the user access to special variables that auto fill into the files would go a very long way. I even think you should give the user the ability to create their own variables for their own custom style projects.
I have been sick the last few days, so I have not gotten to really play with Plaster, and I'm still reading over everything, so I am a bit behind.
rkeithhill commentedon May 20, 2016
@gerane You've pretty much nailed the user scenario we have implemented in this early preview.
Take a gander at this example Plaster manifest - https://github.com/PowerShell/Plaster/blob/master/Examples/NewModuleTemplate/plasterManifest.xml It should give you an idea of the possibilities.
And for file/template expansion, have a look at: https://github.com/PowerShell/Plaster/blob/master/Examples/NewModuleTemplate/MITLicense.txt
Jaykul commentedon May 22, 2016
@RamblingCookieMonster do you really want to mix code generation into your scaffolding?
gerane commentedon Nov 16, 2016
I have been thinking a little bit about use cases, and trying to get into the mode of thinking outside of the box. A few examples that I see being interesting:
I think there were some others that I am forgetting, but I'll try to add those as I remember them.