Forge Home

rvm

Single User Ruby/Gem module (based on RVM) for Puppet >=3.0x

9,494 downloads

8,420 latest version

1.8 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.

Version information

  • 0.3.0 (latest)
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Jan 31st 2015

Start using this module

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

Add this module to your Puppetfile:

mod 'DracoBlue-rvm', '0.3.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add DracoBlue-rvm
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install DracoBlue-rvm --version 0.3.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
Tags: ruby, bash, gem, rvm

Documentation

DracoBlue/rvm — version 0.3.0 Jan 31st 2015

puppet-rvm

This module can be used to install ruby+gems for a single user by using rvm internally. It depends on eirc's single_user_rvm module.

puppet-rvm is copyright 2014-2015 by DracoBlue http://dracoblue.net

Installation

Latest version from puppet forge:

$ puppet module install DracoBlue-rvm

Latest version from git.

$ cd modules
$ git clone https://github.com/DracoBlue/puppet-rvm.git rvm

Dependencies

  • puppetlabs/stdlib >= 4.0.0
  • eirc/single_user_rvm >= 0.3.0

Usage

Example

rvm::ruby { "my blog":
    user => "blog",
    version => "ruby-2.0.0-p247"
}

rvm::gem { "jekyll":
    ruby => Rvm::Ruby["my blog"],
    ensure => "1.5.0"
}

rvm::gem { ["jekyll-sass", "sass", "sass-globbing", "therubyracer"]:
    ruby => Rvm::Ruby["blog"],
    require => [Rvm::Gem["jekyll"]]
}

Result:

  • /home/blog/.rvm contains a rvm installation
  • ruby is available as version ruby-2.0.0-p247
  • the gem jekyll is available in version 1.5.0
  • the gems jekyll-sass, ... are present on the system

Types

rvm::ruby

Define which $version of ruby is installed for the $user.

rvm::ruby { "my blog":
    user => "blog",
    version => "ruby-2.0.0-p247"
}

rvm::gem

Define which version (in $ensure) of $gem must be installed. You may use $name as shortcut for $gem.

rvm::gem { "my blog's jekyll":
    ruby => Rvm::Ruby["my blog"],
    gem => "jekyll",
    ensure => "1.5.0"
}

To make gem present in at least one version:

rvm::gem { "jekyll":
    ruby => Rvm::Ruby["my blog"],
}

To ensure it's uninstalled:

rvm::gem { "jekyll":
    ruby => Rvm::Ruby["my blog"],
    ensure => 'absent'
}

rvm::bash_exec

Is a shell provider based version of exec, which runs the command in a bash login shell. This makes rvm and a proper $PATH available in the environment.

The rvm::bash_exec command is used by rvm::gem and rvm::ruby to set up and work in the users environment.

rvm::bash_exec { "run jekyll":
    user => "blog",
    command => "jekyll build"
}

Hint: rvm::bash_exec tries to behave exactly like exec. Internally it does a su - $USER + bash --login and heavy eascaping on quotation marks. So if you want to run a command only under certian conditions, use puppets unless and onlyif parameters instead of such: if [ ... ]; then ... else; fi stuff.

Changelog

  • 0.3.0 (2015/01/31)
  • 0.2.1 (2014/04/10)
    • replaced self made shell arg escaping with puppets shellquote #1
  • 0.2.0 (2014/03/31)
    • fixed cwd in rvm::bash_exec #1
    • renamed rvm::bash-exec to rvm::bash_exec
  • 0.1.0 (2014/03/30)
    • Initial release

TODOs

  • make tests available (before 1.x release)

License

puppet-rvm is licensed under the terms of MIT.