Skip to content

dgoodlad/puppet-chruby

Repository files navigation

(ch)Ruby Puppet Module for Boxen

Please Note: I am not actively using this module, as it was written purely as a proof-of-concept.

This is an experimental fork of https://github.com/boxen/puppet-ruby which replaces rbenv with chruby. It should be a drop-in replacement, with support for most of the types and classes provided in upstream puppet-ruby.

To use it in your boxen, replace the normal ruby module with this one:

# Puppetfile
github 'ruby', '0.1.0', :repo => 'dgoodlad/puppet-chruby'

Requires the following boxen modules:

  • boxen
  • repository >= 2.1
  • xquartz (OS X only)
  • autoconf (some ruby versions)
  • openssl (ruby versions >= 2.0.0)

Usage

# Set the global default ruby (auto-installs it if it can)
class { 'ruby::global':
  version => '1.9.3'
}

# ensure a certain ruby version is used in a dir
ruby::local { '/path/to/some/project':
  version => '1.9.3-p194'
}

# ensure a gem is installed for a certain ruby version
# note, you can't have duplicate resource names so you have to name like so
ruby::gem { "bundler for ${version}":
  gem     => 'bundler',
  ruby    => $version,
  version => '~> 1.2.0'
}

# install a ruby version
ruby::version { '1.9.3-p194': }

# we provide a ton of predefined ones for you though
require ruby::1_9_3_p194

Hiera configuration

The following variables may be automatically overridden with Hiera:

---
"ruby::chruby_version": "0.3.6"

"ruby::rubybuild_version": "v20130628"

# Careful with these, totally untested
"ruby::chruby_root": "/home/deploy/chruby"

"ruby::user": "deploy"

You can also use JSON if your Hiera is configured for that.