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
{{ message }}
Repository navigation
Probably a small Feature Request: PLASTER_TemplateSource #314
Thanks a lot for this really great and useful module, it's a little difficult to work with the generated files, but it's very helpful for own projects.
Unfortunately, Plaster has a very big issue which would be very easy to solve.
If one would like to contribute to complex foreign projects, then it very often takes a long time to find the source template that belongs to a generated file: We have to grep for similar text, study code and understand the logic - just to get the right template.
Therefore, it would be great if
Plaster could offer a Variable which references the exact path of the used template, for example, PLASTER_TemplateSource or PLASTER_TemplateFileName (…Source is more generic and could later be extended for generated Text which is not based on a Template but just on Code)
Plaster recommends as best practices to always use this Variable in generated files.
This could include the necessary hint in the generated files:
MyFile.ps1
# Generated by Plaster
# Template: xxx
At least for me, it would save hours.
Thanks a lot, kind regards,
Thomas
Hi Laurent,
Thank you very much for your hint!,
I saw the PLASTER_TemplatePath variable, but to get just a path still leaves many possibilities and questions open.
It would be really useful (or at least not harmful) if Plaster offers the used Template filename, too.
Additionally, it would be useful if Plaster sets a good example, uses these variables itself and recommends it as best practices.
Many projects are hoping for free staff and this simple measure would make it much easier to get started, because many things are built around templates.
But another solution is to place the information in the file to transform, like here
Additionally, it would be useful if Plaster sets a good example, uses these variables itself
I think it was planned, but for the moment I do not know if this project is in sleep because of lack of time of the contributors. I am not the right person to answer that point.
and recommends it as best practices.
Localizing is not easy if you do not want to duplicate xml files.
To do one thing by template file is better, but can we call this a 'good practice'?
I do not know if this project is in sleep because of lack of time of the contributors
That's a fair assessment. :-) I will get back to the issue backlog but right now am busy on other OSS projects - namely the VSCode extension for PowerShell, PSES and posh-git. BTW thanks @LaurentDardenne for your continued support and help on this project.
# Generated by Plaster
# Template: xxx
That's a reasonable ask but IMO it should be put somewhere in each template's source files and not automatically added by Plaster. We'd screw up certain types of files where say # is not a comment e.g. XML files.
I supposed Plaster could emit some sort of "template fingerprint/info" file but I could see folks getting annoyed by that - having to delete it most of the time so it didn't get committed to version control.
Hi Laurent, thank you very much for your support and your explanations!
Yes, I always forget Localizing... and I enjoy it every day.
I will start using your proposed code in the opensource projects where I can contribute. It will hopefully work like a virus, so that others are starting to use it, too ;-)
Hi Keith thanks a lot for your answer and support, too!,
Yes, my idea was not that Plaster automatically creates references to the used template in all generated files by itself.
My idea was that if Plaster also works internally with Plaster templates or if it offers template examples, that these templates includes the source information wherever possible and useful.
The file name is always 'plasterManifest.xml' or 'plasterManifest_(CultureName).xml)'
That's true, but the Manifest.xml probably isn't the template itself.
To get useful Information, this is not enough for foreign contributors and it makes their work unnecessarily difficult.
Example usage in this Project: PowerShell ModuleBuild
The ModuleBuild Project has a lot of template files. Let's test PLASTER_TemplatePath:
The Template File is: C:\…\Modules\ModuleBuild\0.2.2\plaster\ModuleBuild\scaffold\Build.template
The inserted statement is: # Used Template: <%=$PLASTER_TemplatePath%>
The generated File: Plaster just inserts the Directory of the Manifest.xml file. # Used Template: C:\…\Modules\ModuleBuild\0.2.2\plaster\ModuleBuild
Result: Unfortunately, the result is almost useless,
because the declared Directory contains more than 100 files :-(
Therefore, I keep asking that Plaster sometimes will introduce a Variable to declare the real used template Filename, something like PLASTER_TemplateSource
Activity
LaurentDardenne commentedon Mar 28, 2018
You can use this variables :
Check if PLASTER_TemplatePath still contains the versionning of the container (module/script)?
schittli commentedon Mar 28, 2018
Hi Laurent,
Thank you very much for your hint!,
I saw the
PLASTER_TemplatePathvariable, but to get just a path still leaves many possibilities and questions open.Many projects are hoping for free staff and this simple measure would make it much easier to get started, because many things are built around templates.
Kind regards, Thomas
LaurentDardenne commentedon Mar 28, 2018
The file name is always 'plasterManifest.xml' or 'plasterManifest_(CultureName).xml)'
This module contains two templates :
If you want to indicate the original template, here it would be something like:
But another solution is to place the information in the file to transform, like here
I think it was planned, but for the moment I do not know if this project is in sleep because of lack of time of the contributors. I am not the right person to answer that point.
Localizing is not easy if you do not want to duplicate xml files.
To do one thing by template file is better, but can we call this a 'good practice'?
rkeithhill commentedon Mar 28, 2018
That's a fair assessment. :-) I will get back to the issue backlog but right now am busy on other OSS projects - namely the VSCode extension for PowerShell, PSES and posh-git. BTW thanks @LaurentDardenne for your continued support and help on this project.
That's a reasonable ask but IMO it should be put somewhere in each template's source files and not automatically added by Plaster. We'd screw up certain types of files where say
#is not a comment e.g. XML files.I supposed Plaster could emit some sort of "template fingerprint/info" file but I could see folks getting annoyed by that - having to delete it most of the time so it didn't get committed to version control.
schittli commentedon Mar 29, 2018
Hi Laurent,
thank you very much for your support and your explanations!
Yes, I always forget Localizing... and I enjoy it every day.
I will start using your proposed code in the opensource projects where I can contribute. It will hopefully work like a virus, so that others are starting to use it, too ;-)
Kind regards, Thomas
schittli commentedon Mar 29, 2018
Hi Keith
thanks a lot for your answer and support, too!,
Yes, my idea was not that Plaster automatically creates references to the used template in all generated files by itself.
My idea was that if Plaster also works internally with Plaster templates or if it offers template examples, that these templates includes the source information wherever possible and useful.
Kind regards, Thomas
schittli commentedon Mar 29, 2018
Good evening
That's true, but the Manifest.xml probably isn't the template itself.
To get useful Information, this is not enough for foreign contributors and it makes their work unnecessarily difficult.
Example usage in this Project:
PowerShell ModuleBuildThe ModuleBuild Project has a lot of template files. Let's test
PLASTER_TemplatePath:C:\…\Modules\ModuleBuild\0.2.2\plaster\ModuleBuild\scaffold\Build.template# Used Template: <%=$PLASTER_TemplatePath%># Used Template: C:\…\Modules\ModuleBuild\0.2.2\plaster\ModuleBuildResult: Unfortunately, the result is almost useless,
because the declared Directory contains more than 100 files :-(
Therefore, I keep asking that Plaster sometimes will introduce a Variable to declare the real used template Filename, something like
PLASTER_TemplateSourceThanks a lot,
kind regards, Thomas
schittli commentedon Mar 29, 2018
Good evening
I've just created a pull request which introduces the new variable
PLASTER_TemplateSource:Pull request: #316
It's really hard to contribute to this Module:
after a long time, I had to stop to try debugging Plaster and I had to add Tracing-Messages. Very annoying.
If someone could give some starting tips & tricks for contributors, I guess this will be useful :-)
Kind regards, Thomas