I'm just a ready-made update to Carlo Zottman ruby 1.9.x cookbook (noticed this question during lunch, before writing a pull request, lol ...)
The only dependencies are standard prefabricated and useful cookbooks from the opscode cookbook website.
Regarding the discussion about when such a cookbook may be needed, I use it to upgrade from ruby ββ1.8 to ruby ββ1.9 on my firewalls 12.04.01 before using the cookbook rbenv (and others).
I understand that I have to use the rbenv cookbook to install 1.9.3, but after working unsuccessfully for a couple of hours, I realized that in any case, I was happier with the original installation, as this makes my whole set of recipes less fragile. And a shell script to install rbenv 1.9.3, since the roaming user was trivial to write.
Update
I found an alternative approach in which there are even fewer dependencies (yes!) I use the Fletcher Nichol cookbooks :
- ruby_build on the opscode community page
- github chef-rbenv (not the same as rbenv cookbook on opscode)
Strictly speaking, of course, you could just use ruby_build to set your preferred 1.9 and stop, but I want rbenv too.
I included some fragments from my installation (of course, in Berksfile and Vagrantfile, but these are the corresponding bits). The only really tricky part is that the local chef-rbenv cookbook name must be rbenv if you want to use any ready-made recipes that include other cookbook recipes, as it refers to itself as rbenv. Berkshelf did this trivially.
Berksfile :
group :ruby do cookbook 'ruby_build' cookbook 'rbenv', git: 'https://github.com/fnichol/chef-rbenv' end
Vagrantfile:
config.vm.provision :chef_solo do |chef| chef.cookbooks_path = 'chef/cookbooks' chef.roles_path = 'chef/roles' chef.json = { 'rbenv' => { 'global' => '1.9.3-p194', 'rubies' => [ '1.9.3-p194' ], 'gems' => { '1.9.3-p194' => [ { 'name' => 'bundler' } ] } } } chef.add_role 'ruby' end
cook / roles / ruby.json:
{ "name": "ruby", "description": "Install ruby and rbenv", "chef_type": "role", "json_class": "Chef::Role", "run_list": [ "recipe[ruby_build]", "recipe[rbenv::system]" ] }
The final note is that as soon as I understood the solution, I realized that Victor's answer is probably the version of the chefβs server of the same. So far, I have only used a chef, so I'm not sure.