Last active
August 29, 2015 13:56
-
-
Save mindreframer/9052527 to your computer and use it in GitHub Desktop.
fixing not required libraries for chef
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## to fix lib dependency, put this on top of your recipe file. | |
self.run_context.cookbook_collection[self.cookbook_name].library_filenames.each { |e| load(e) } | |
## in a cookbook, that needs my_cookbook | |
## in metadata.rb | |
depends 'my_cookbook' | |
# my_cookbook/libraries/helpers.rb | |
module MyCookbook | |
module Helpers | |
def foo | |
"foo" | |
end | |
end | |
end | |
# my_cookbook/recipes/default.rb | |
##self.run_context.cookbook_collection[self.cookbook_name].library_filenames.each { |e| load(e) } | |
extend ::MyCookbook::Helpers # this would not work without the line above. maybe something wrong with my chef version | |
raise foo.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment