Open MikaelPorttila opened 8 years ago
Thanks for the PR, I'm going to take a look now.
I noticed that $Global:pecanwafflesettings.Templates gets reset in every new Powershell instance - bug or feature? :)
You can override those settings with env vars, see https://github.com/ligershark/pecan-waffle/wiki/How-to-use-the-build-script#special-environment-variables.
@MikaelPorttila thanks a lot for the contribution! I made a few comments on the PR.
Would you also consider adding a unit test to main.tests.ps1
? I looked to see if there was a good test that you could copy/paste to get started but I didn't find a good one. I think to test this the easiest way is to register two or more templates and then call the remove function. To do that I think the following would work.
$templateInfo = New-Object -TypeName psobject -Property @{
Name = 'test01'
Type = 'ProjectTemplate'
}
Set-TemplateInfo -templateInfo $templateInfo -templateRoot $pwd
$templateInfo = New-Object -TypeName psobject -Property @{
Name = 'test02'
Type = 'ProjectTemplate'
}
Set-TemplateInfo -templateInfo $templateInfo -templateRoot $pwd
Remove-PWTemplate 'test01'
# todo: validate
FYI since you sent the PR I wrote up some notes on how to use the build script at https://github.com/ligershark/pecan-waffle/wiki/How-to-use-the-build-script. It's pretty easy to get started with that.
Thanks again for the PR.
This code should be fine. I noticed that $Global:pecanwafflesettings.Templates gets reset in every new Powershell instance - bug or feature? :)