Thursday, 13 December 2012

How to install a ruby gem in chef

Hello

This seems to stump a few people. You are wanting to leverage some super cool gem to make your recipes even more all powerful right? The thing is you can't get the bloody thing to install

Fear not



gem_package "nokogiri" do
  action :nothing
end.run_action(:install)

gem 'nokogiri'
require 'nokogiri'

This is all the code that you need to install and require a gem in your recipe.