Skip to content
This repository was archived by the owner on Nov 11, 2017. It is now read-only.

randomvariable/EmbeddedPowerShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Embedded PowerShell

A port of ERB to PowerShell. For no apparent reason.

As said in the Puppet documentation:

EPS1 is Plain Text With Embedded PowerShell

This script processes "eps1" files in a similar fashon to Embedded Ruby Templating (as used by Puppet).

There isn't much logic involved - any expressions will be evaluated as normal PowerShell.

To run

Expand EPS1 templates using the following command:

.\Expand-EPS1.ps1 -Text $texttoprocess

EPS1 Syntax

From the Puppet Docs

  • <%= PowerShell expression %> — This tag will be replaced with the value of the expression it contains.

  • <% PowerShell code %> — This tag will execute the code it contains, but will not be replaced by a value. Useful for conditional or looping logic, setting variables, and manipulating data before printing it.

  • <%# comment %> — Anything in this tag will be suppressed in the final output.

  • <%% or %%> — A literal <% or %>, respectively.

  • <%- — Same as <%, but suppresses any leading whitespace in the final output. Useful when indenting blocks of code for readability.

  • -%> — Same as %>, but suppresses the subsequent line break in the final output. Useful with many lines of non-printing code in a row, which would otherwise appear as a long stretch of blank lines.

The code is very loosely based upon http://blogs.msdn.com/b/mwilbur/archive/2007/03/14/powershell-template-engine.aspx.

Apache 2.0 License

About

A port of ERB to PowerShell. For no apparent reason.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published