Closed eedwards-sk closed 6 years ago
The gem
metadata field was added far after this project (and in part as a response to it), but I've never needed it so I haven't bothered adding support.
Also just a general thing, I wouldn't really recommend using this. I've mostly cycled down on Chef stuff in the past year as it is slowly drifting towards being obsolete. If you're going to use my toolchain, assume you need to support it all yourself.
@coderanger thanks for the update and response!
I love the idea of using gem testing patterns for chef projects so I had been gravitating toward using your pattern, but even when spelunking among your own projects I'm having trouble finding example use cases of how to implement it properly.
I definitely appreciate the candor... I'll have to rethink my approach, but this has been great inspiration. Hope your career is going well :)
If you do want to make your own fork and add it, you can probably pull the needed dependency info out my existing gem scraping code :) Right now I just raise an exception on any runtime deps that aren't either halite itself (or chef) or a cookbook, instead just take that list an map them to gem
metadata lines. If you wanted to make it more bulletproof it should check for a c-ext in the gem since that will almost certainly not work correctly as a cookbook dep.
As it stands, it's unclear what the proper way is to propagate gem dependencies used for the cookbook from the gem itself into the generated cookbook.
e.g. in my gemspec I can require a gem:
spec.add_runtime_dependency 'my_org-my_utils'
and I can force it to a local path in the Gemfile:
However, this doesn't seem to pass that requirement into the cookbook that gets generated.
Chef supports a
gem
field for metadata.rb which will automatically usechef_gem
to load gems.However, it doesn't appear that I can append
gem
entries to the generatedmetadata.rb
So, what is the proper/recommended way of propagating these dependencies?