diff options
author | danielsdeleo <dan@opscode.com> | 2013-05-26 15:45:54 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-05-29 11:32:22 -0700 |
commit | e7d836f1bc6478a05419abb242197eee98c803b1 (patch) | |
tree | d451cc0e4a5d3fabece658bc3bb1d25816e433cc /spec/data | |
parent | fa4c2ec1560da0c295482072df60fc7cb36c2504 (diff) | |
download | chef-e7d836f1bc6478a05419abb242197eee98c803b1.tar.gz |
Add helper method/module support to template resource
Adds helper methods to a template via the following syntax:
```
template "name" do
# singular method definition:
helper(:method_name) { method_body }
# inline module definition
helpers do
def method_name
method_body
end
end
# external module inclusion
helpers(MyHelperModule)
end
```
In each of the above cases, variables defined by Chef (e.g., `@node`)
or the user (via `:variables => {}`) can be accessed as normal.
Could use the following improvements:
- Template partials are not supported
- Input validation on Resource::Template should be improved
- Needs Unit tests for Template provider/implementation classes
Diffstat (limited to 'spec/data')
-rw-r--r-- | spec/data/cookbooks/openldap/templates/default/helper_test.erb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/spec/data/cookbooks/openldap/templates/default/helper_test.erb b/spec/data/cookbooks/openldap/templates/default/helper_test.erb new file mode 100644 index 0000000000..92e6fe0427 --- /dev/null +++ b/spec/data/cookbooks/openldap/templates/default/helper_test.erb @@ -0,0 +1 @@ +<%= helper_method %> |