Configset Helpers

Helpers allow you to extend the Configset DSL.

Example

Here’s a simple example that will add a yum keyword.

lib/helpers/yum_helper.rb

module YumHelper
  def yum(*packages)
    list = packages.inject({}) { |result, p| result.merge(p => []) }
    package("yum", list)
  end
end

Now you can use like so:

yum("tree", "vim")

And it’ll generate something like this:

---
AWS::CloudFormation::Init:
  configSets:
    default:
    - main
  main:
    packages:
      yum:
        tree: []
        vim: []

Both ERB and DSL from supports adding your own custom helpers.

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!