-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduces the new variable PLASTER_TemplateSource #316
Conversation
…the template full FileName which is used to create a File Example of use: # Used Template: <%=$PLASTER_TemplateSource%> Will get the full Template name: # Used Template PowerShellOrg#2: C:\…\scaffold\Build.template
src/InvokePlaster.ps1
Outdated
|
||
|
||
# Dot source the individual module command scripts. | ||
. .\NewPlasterManifest.ps1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't dot source these here but in the psm1 file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this one... thanks a lot for cleaning it.
src/InvokePlaster.ps1
Outdated
. .\WritePlasterParameter.ps1 | ||
. .\WritePlasterManifestContent.ps1 | ||
|
||
Invoke-Plaster c:\GitWork\Clones\GitHub\�Tom\ModuleBuild\release\ModuleBuild\plaster\ModuleBuild\ c:\Temp\--\-PSModul\ModuleBuildTest2\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is up with this but it needs to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very sorry that I missed this debugging code and checked it in.
Thanks for removing it!
src/InvokePlaster.ps1
Outdated
@@ -1133,6 +1133,8 @@ function Invoke-Plaster { | |||
|
|||
# Eval script expression delimiters | |||
if ($content -and ($content.Count -gt 0)) { | |||
# Sets the Variable to the currently used template | |||
Set-Variable -Name PLASTER_TemplateSource -Value $srcPath -Scope Script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is reasonable but I'd probably want to name this something like PLASTER_TemplateFileSource
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my tests, it worked fine...
PLASTER_TemplateFileSource
is more precise than PLASTER_TemplateSource
I was not sure if there are situations, where Files are created just by code (without any template file) and then, PLASTER_TemplateSource
could be used for both situations (Generated by code and generated by Template)
- Renamed the new Variable to `PLASTER_TemplateFileSource` - Removed the 'debugging Code' Lines at the very end of the source file. I'm very sorry for this.
This was my 1st contribution with bugs and I did not know the workflow... I just have fixed the issues and hope it's done the right way... |
Good evening |
@@ -1133,6 +1133,8 @@ function Invoke-Plaster { | |||
|
|||
# Eval script expression delimiters | |||
if ($content -and ($content.Count -gt 0)) { | |||
# Sets the Variable to the currently used template | |||
Set-Variable -Name PLASTER_TemplateFileSource -Value $srcPath -Scope Script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this doesn't work "as-is" because setting a variable in this runspace doesn't help since the template file is processed in a constrained runspace. The variable needs to be set there. I'll noodle on this some as I really like the idea of providing this info inside a template file.
Not needed |
The new variable PLASTER_TemplateSource references the template full FileName which is used to build a File. Example of use:
# Used Template: <%=$PLASTER_TemplateSource%>
Will get the full Template name:
# Used Template #2: C:\…\scaffold\Build.template