From 038f71b44b1937dd1f349386b6af1a162091c3db Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 20 Nov 2012 17:36:12 -0500 Subject: 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 => . 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). --- manifests/install.pp | 14 +++++++++----- manifests/params.pp | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'manifests') 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' -- cgit v1.2.3