diff options
author | Micah Anderson <micah@riseup.net> | 2012-11-20 17:36:12 -0500 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2012-11-20 17:36:12 -0500 |
commit | 038f71b44b1937dd1f349386b6af1a162091c3db (patch) | |
tree | ce01697a901bf4543a86b275d1b2d70e3c0472bd | |
parent | f7ceb6d84bf692b98148f75be7cc6584a55bf1a3 (diff) |
replace $use_rvm with $install_method to enable more flexible installation
possibilities
The $use_rvm variable was limited to either using rvm or not, so we replace that
with $install_method, defaulting to the previous usage
If you set $use_rvm it to not use rvm, then the module would just use the
gem. This made it so you couldn't install bundler via a package. So the
$install_method was added which enabled you to alter how the non-rvm
installation was provided.
Unfortunately, it was a mistake to have both $use_rvm and $install_method
because $use_rvm is 'true' by default, so if you tried to set an install_method,
then it wouldn't work because it would just use the rvm method. So in order to
install via something other than rvm or gem, you would need to do both use_rvm
=> false; install_method => <whatever>.
Just having the install_method parameter is much cleaner, because it is generic,
doesn't require multiple settings when not installing via rvm or gem, and it
defaults to what the module was doing before (using rvm by default).
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | manifests/install.pp | 14 | ||||
-rw-r--r-- | manifests/params.pp | 3 |
3 files changed, 25 insertions, 14 deletions
@@ -9,14 +9,22 @@ This module supports Ubuntu 10.04 and Debian Installation ------------ -1. Copy this directory to your puppet master module path $(git clone https://github.com/evanstachowiak/puppet-bundler bundler) -2. Apply the `bundler` class to any nodes you want bundler installed on: +1. Copy this directory to your puppet master module path $(git clone +https://github.com/evanstachowiak/puppet-bundler bundler) + +2. Apply the `bundler` class to any nodes you want bundler installed on: + class { 'bundler::install': } - By default this will install bundler as a gem, if you wish to use another method, you can pass any puppet package provider - to the class as 'install_method', or use 'undef' if you wish the puppet parser to automatically chose the best method for - your platform. - Examples: class { 'bundler::install': install_method => fink}; - class { 'bundler::install': install_method => undef} + + By default this will install bundler with RVM, if you wish to use another + method, you can pass any puppet package provider to the class as + 'install_method', or just use '' if you wish the puppet parser to + automatically chose the best method for your platform. + + Examples: class { 'bundler::install': install_method => 'fink' }; + class { 'bundler::install': install_method => 'gem' }; + class { 'bundler::install': install_method => '' } + 3. Set whatever config variables are necessary: bundler::config { 'linecache19': user => ubuntu, diff --git a/manifests/install.pp b/manifests/install.pp index e464390..73ceb59 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -18,17 +18,21 @@ # include rvm # class bundler::install ( - $ruby_version, + $ruby_version = undef, $ensure = 'present', - $use_rvm = $bundler::params::use_rvm, $install_method = $bundler::params::install_method, ) inherits bundler::params { - if $use_rvm == true { - #Install bundler with correct RVM - rvm_gem { 'bundler': + if $install_method == 'rvm' { + if $ruby_version == undef { + fail('When using rvm, you must pass a ruby_version') + } + else { + #Install bundler with correct RVM + rvm_gem { 'bundler': ensure => $ensure, ruby_version => $ruby_version, + } } } else { diff --git a/manifests/params.pp b/manifests/params.pp index b80dbab..53ca86e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,8 +17,7 @@ class bundler::params { ubuntu, debian: { $user = 'root' $home_dir_base_path = '/home' - $use_rvm = true - $install_method = gem + $install_method = 'rvm' $rvm_bin = '/usr/local/rvm/bin/rvm' $rvm_gem_path = '/usr/local/rvm/gems' $rvm_gemset = 'global' |