Baldowl

my nest somewhere in GitHub's forest

Using Chef And Bundler Together

An old friend of mine recently needed to start using Bundler in a scenario managed by Chef via chef-solo.

Up to now, the gems in that setup had been managed semi-manually (a simple list of gems to be installed used by Chef’s gem_package resource) and the Chef’s standard deploy resource does not support using Bundler right out of the box. Fortunately, the hooks provided via the four callbacks are more than enough.

So, my homemade solution was to use the before_migrate callback:

Nesting a script resource inside the deploy resource forced me to “extract” some things from new_resource (the deploy resource) and store all in local variables, but at the end of the day the code is clear and tidy, the intent is evident and everything works perfectly.