I need ERB (Ruby\'s templating system) for templating of non-HTML files.
(Instead, I want to use it for source files such as .java, .cs, ...)
Found this question while trying to test my Puppet templates.
Ended with this solution:
foo.erb
create a file foo.vars.erb
Put all your template variables into that new file, e.g.:
<% @my_param="foo bar" %>
<% @another_param=123 %>
or (equivalent):
<%
@my_param="foo bar"
@another_param=123
%>
On command line run this:
cat foo.vars.erb foo.erb | erb
Your fully rendered template should now be printed to std-out. From there you check the output by hand, or you can take diff (or other tools) to compare it to a pre-rendered output.