Closed tomeon closed 9 years ago
Thank you!
This is an idea that I've been thinking about myself and I agree that it is a good way forward. However for an actual implementation I would much rather use the Hiera component of Puppet to achieve this - fpm-cookery already uses Puppet and Facter as helpers.
What do you think, would you be interested in helping me out trying to do this using Hiera?
Absolutely -- I'd love to help with implementing Hiera! I had actually looked into doing that, but couldn't find much in the way of API documentation for using Hiera in code. Might be time to start digging into the source :).
Closing pull request; beginning research into Hiera.
This PR is more of an RFC given my weak Ruby-fu. The idea is to allow configuration data like source URL, package name, etc., to be specified in a YAML file (optionally containing embedded Ruby) rather than in the recipe class itself. I find this approach clearer, as it separates data from business logic.
The basic idea is to have a YAML file (by default,
config.yml
in the same directory asrecipe.rb
) of the form:Then,
fpm-cookery
automatically calls any methods whose names correspond to the top-level keys of the hash created by loading the YAML file. Bonus: the YAML data is processed recursively, so you can use data from the file as template variables for ERB (see the use ofbranch
, above).Please let me know what you think of this idea. If it looks useful, I can set up some test cases to make sure everything works as expected. Thanks!