Forge Home

rbenv

rbenv Ruby Version Manager module

90,372 downloads

86,651 latest version

3.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 1.2.0 (latest)
  • 1.1.0
  • 1.0.0
  • 0.3.1
  • 0.3.0
  • 0.2.0
  • 0.1.0
  • 0.0.2
  • 0.0.1
released Feb 17th 2013

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'alup-rbenv', '1.2.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add alup-rbenv
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install alup-rbenv --version 1.2.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

alup/rbenv — version 1.2.0 Feb 17th 2013

Puppet-Rbenv

Build Status endorse

About

This project provides powerful manifests for the installation of rbenv (Ruby Version Management). In a nutshell, it supports the following conveniences:

  • Defined resources for the installation of rbenvs for one or more users, shared or standalone.
  • Resources for the compilation of ruby interpreters (one or many, custom or predefined ruby build definitions), under specific rbenvs, users.
  • Tools for the installation of arbitrary gems under specific rbenvs.
  • Infrastructure to support rbenv plugins. We have already included ruby-build and rbenv-vars plugins.
  • Resource for handling bundler.

Rbenv installation

You can use the module in your manifest with the following code:

rbenv::install { "someuser":
  group => 'project',
  home  => '/project'
}

This will apply an rbenv installation under "someuser" home dir and place it into ".rbenv". You can change the resource title to your taste, and pass the user on which install rbenv using the user parameter.

The rbenv directory can be changed by passing the "root" parameter, that must be an absolute path.

Ruby compilation

To compile a ruby interpreter, you use rbenv::compile as follows:

rbenv::compile { "1.9.3-p327":
  user => "someuser",
  home => "/project",
}

The resource title is used as the ruby version, but if you have multiple rubies under multiple users, you'll have to define them explicitly:

rbenv::compile { "foo/1.8.7":
  user => "foo",
  ruby => "1.8.7-p370",
}

rbenv::compile { "bar/1.8.7":
  user => bar",
  ruby => "1.8.7-p370",
}

rbenv rehash is performed each time a new ruby or a new gem is installed.

You can use the global => true parameter to set an interpreter as the default (rbenv global) one for the given user. Please note that only one global is allowed, duplicate resources will be defined if you specify multiple global ruby version.

You can also provide a custom build definition to ruby-build by specifying a source that can either be a puppet: source or a file to be downloaded using wget:

rbenv::compile { "patched-ree":
  user   => "someuser",
  home   => "/project",
  source => "puppet://path-to-definition"
}

Gem installation

You can install and keep gems updated for a specific ruby interpreter:

rbenv::gem { "unicorn":
  user => "foobarbaz",
  ruby => "1.9.3-p327",
}

Gems are handled using a custom Package provider that handles gems, somewhat inspired by Puppet's Package one - thus absent and latest work as expected.

rbenv plugins

To add a plugin to a rbenv installation, you use rbenv::plugin as follows:

rbenv::plugin { "my-plugin":
  user   => "someuser",
  source => "git://github.com/user/my-plugin.git"
}

There's also a built-in resource to add rbenv-vars for a user:

rbenv::plugin::rbenvvars { "someuser":
  # Optional:
  # source => "git://path-to-your/custom/rbenv-vars.git"
}

NOTICE: rbenv::install automatically requires ruby-build to compile rubies, if you want to use a different repository, you can specify the resource on a separate manifest:

rbenv::plugin::rubybuild { "someuser":
  source => "git://path-to-your/git/repo"
}

Install module from puppet forge

You can install the latest release of this module by using the following command:

puppet module install alup-rbenv

Usage with Vagrant

A simple way to test this module is by using the Vagrant library.

An example of a Vagrantfile:

Vagrant::Config.run do |config|
   config.vm.box = "lucid32"
   config.vm.provision :puppet, :facter => { "osfamily" => "debian" }, :module_path => "modules" do |puppet|
     puppet.manifests_path = "manifests"
     puppet.manifest_file  = "base.pp"
     puppet.options        = %w[ --libdir=\\$modulepath/rbenv/lib ]
   end
end

The --libdir=\\$modulepath/rbenv/lib argument is important to make puppet aware of the rbenvgem custom provider and type.

Supported Platforms

  • CentOS
  • Debian
  • RHEL
  • SuSE
  • Ubuntu

License

MIT License.

Copyright 2012 Andreas Loupasakis, Marcello Barnaba vjt@openssl.it, Fabio Rehm