Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

schittli
Copy link

@schittli schittli commented Mar 29, 2018

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

…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


# Dot source the individual module command scripts.
. .\NewPlasterManifest.ps1
Copy link
Collaborator

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.

Copy link
Author

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.

. .\WritePlasterParameter.ps1
. .\WritePlasterManifestContent.ps1

Invoke-Plaster c:\GitWork\Clones\GitHub\�Tom\ModuleBuild\release\ModuleBuild\plaster\ModuleBuild\ c:\Temp\--\-PSModul\ModuleBuildTest2\
Copy link
Collaborator

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.

Copy link
Author

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!

@@ -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
Copy link
Collaborator

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.

Copy link
Author

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.
@schittli
Copy link
Author

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...

@schittli
Copy link
Author

schittli commented Apr 9, 2018

Good evening
I had fixed the issues... I hope that I did not have missed something.
Kind regards, Thomas

@@ -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
Copy link
Collaborator

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.

@psjamesp psjamesp closed this Apr 30, 2022
@psjamesp
Copy link
Contributor

Not needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants