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

Support ERB templates in software. #79

Merged
merged 2 commits into from
Dec 4, 2013
Merged

Support ERB templates in software. #79

merged 2 commits into from
Dec 4, 2013

Conversation

ohlol
Copy link

@ohlol ohlol commented Nov 15, 2013

I have a lot of these, I imagine others might find this useful as well.

@schisamo
Copy link
Contributor

I see this being very useful. What say you @christophermaier, @danielsdeleo and @lamont-granquist?

block do
template = ERB.new(File.new(source_path).read, nil, "%")
File.open(args[:dest], "w") do |file|
file.write(template.result(OpenStruct.new(args[:vars]).instance_eval { binding }))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the OpenStruct here for? To let you access variables in your template as methods? I have kind of a pathological hatred of OpenStruct because it has the most performance hostile implementation possible for a ruby library, but performance of the ruby code in Omnibus isn't the critical path, so maybe I can get over it.

@danielsdeleo
Copy link
Contributor

Seems like a useful feature to me.

@lamont-granquist
Copy link
Contributor

works for me

schisamo added a commit that referenced this pull request Dec 4, 2013
Support ERB templates in software.
@schisamo schisamo merged commit da3f3fc into chef:master Dec 4, 2013
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.

4 participants