-
Notifications
You must be signed in to change notification settings - Fork 213
Automatically add Librarian's install directory to cookbook_paths #226
Conversation
Make it possible to manipulate the list when using Librarian or Berkshelf.
@@ -107,7 +107,17 @@ def sync_kitchen | |||
end | |||
|
|||
def cookbook_paths | |||
Array(Chef::Config[:cookbook_path]) + [KnifeSolo.resource('patch_cookbooks').to_s] | |||
unless @cookbook_paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to memoize this? Seems like it might not be worth the code bloat. If you take out memoization and add a helper method this could be expanded_config_paths + [patch_cookbooks_path]
. Or with the helper methods you could just add a ||=
to memoize that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand and like the use of helper methods, but how could the dynamic adding work unless we store the updated list in an instance variable? Adding is done when running Librarian or Berkshelf, and later we use the list when rsyncing and generating solo.rb. Sorry if I'm not following...
Kinda neat how that works. Would love a test on it though. |
Will add tests. Just made the PR to get comments and that seemed to work great. Thanks. =) |
Extracted helpers and added tests. |
Ooo... much nicer. I approve of this. |
Automatically add Librarian's install directory to cookbook_paths
No tests and all the path config should maybe be extracted to own class, but quite cool, isn't it? =)