Modern cook cookbook for rubies

Is there an updated cookbook for rubies? I could not find it on the opscode cookbook website. i.e. ruby ​​1.9.3 or 1.9.2p280.

+7
source share
3 answers

I’m not sure that you will find it for updating the system version of Ruby, since the chef is built on top of Ruby and therefore will be updated during work, which I'm not sure about.

However, I definitely saw cookbooks for chefs for Ruby version managers such as RBenv and RVM, such as this one for rbenv and this one for RVM . Is it for server or OSX dev box? if this is for later, then I found Smeagol to be a pretty convenient shortcut when setting up machines.

+3
source

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.

+4
source

I think it’s easiest to use two cookbooks: ruby_build and rbenv. In your role ( <proj>/roles/role_name.rb ):

 name "your-role-name" description "All the shelves!" run_list( "recipe[ruby_build]", "recipe[rbenv::system]" ) override_attributes( 'rbenv' => { 'global' => '1.9.2-p280', 'rubies' => [ '1.9.2-p280' ] } ) 

Adding this role (preferably before other roles that require these rubies) to your execution list should do this.

To edit the launch list: knife node edit <node name>

Do not forget to update the role! knife role from file role_name.rb

Finally, rubyenv can be a slightly cleaner way to manage rubies than rvm.

0
source

All Articles