Skip to content

Lytro/chef_ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chef_ruby

Installs Ruby 1.9.x or 2.0.x from source.

Acknowledgements

RVM in conjunction with Chef is shit.

Cookbook Requirements

  • apt
  • build-essential

Attributes

  • default[:chef_ruby][:version] = "2.0.0-p247": string containing the ruby version you want to install.
  • default[:chef_ruby][:rubygems][:version] = "2.0.6": string containing the rubygems version you want to install.
  • default[:chef_ruby][:checksum] = '3e...d3': checksum of the Ruby tarball.
  • default[:chef_ruby][:rubygems][:checksum] = '36...39': checksum of the RubyGems tarball.
  • default[:chef_ruby][:prefix] = '/usr': configure prefix path for Ruby.
  • default[:chef_ruby][:make_opts] = '-j10': make options for building Ruby.

You can update the tarball checksums on OS X using shasum -a 256 followed by the path of the tarballs. Or, alternatively, use Curl as follows.

curl http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | shasum -a 256
curl http://http://production.cf.rubygems.org/rubygems/rubygems-2.0.6.tgz | shasum -a 256

Recipes

  • default: installs Ruby from source.

Usage

When setting up a system for the first time, Ohai will profile it and then store the ruby directory as /opt/chef/embedded/lib/ruby. This attribute (normally referenced in cookbooks as languages[:ruby][:gems_dir]) does not get reset automatically when a new Ruby is installed. The default recipe tells Ohai to reload its attributes. Adding this block to any recipe that uses the attribute languages[:ruby][:gems_dir]; then, whenever Ohai reloads its attributes, your cookbook will also reload its attributes.

ruby_block "reload_ruby" do
  block do
    node.load_attribute_by_short_filename('<filename of attributes, eg default>', '<name of cookbook that contains the attributes>')
  end

  action :nothing
  subscribes :create, "ohai[reload]", :immediately
end

Legal

This cookbook was originally written by Carlo Zottmann but he seems to have stopped maintaining it. Now it is maintained by Lytro.

About

A Chef Cookbook that installs Ruby.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages