Reputation: 79
I am writing a cookbook that defines four custom resources. There are multiple constants that should be shared across all of the resources (permissions for certain types of files, prefixes for names, relative paths etc...).
How can I share these constants across multiple custom resources?
Upvotes: 1
Views: 393
Reputation: 54181
Put em' in a module under libraries/default.rb
:
module MyCookbook
BASE_PATH = '/foo'
end
# And then in the resource
property(:path, default: MyCookbook::BASE_PATH)
or somesuch.
Upvotes: 5