From 9d27878ceac3b4f8e34b4cdda6a31a8cd4c67319 Mon Sep 17 00:00:00 2001 From: Ryan Wilcox Date: Thu, 7 Mar 2013 15:44:02 -0500 Subject: [PATCH 1/3] support passing compile options Conflicts: lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb lib/puppet/type/rvm_system_ruby.rb --- lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb | 8 +++++++- lib/puppet/type/rvm_system_ruby.rb | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb b/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb index 9f5b433f..5ca31bb7 100644 --- a/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb +++ b/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb @@ -4,7 +4,13 @@ commands :rvmcmd => "/usr/local/rvm/bin/rvm" def create - rvmcmd "install", resource[:name] + if resource[:pkg] + puts "rvmcmd pkg install #{resource[:pkg]}" + rvmcmd "pkg install", resource[:pkg] + end + + options = resource[:withopts] + rvmcmd "install", resource[:name], options set_default if resource.value(:default_use) end diff --git a/lib/puppet/type/rvm_system_ruby.rb b/lib/puppet/type/rvm_system_ruby.rb index 59069a10..841dfb4b 100644 --- a/lib/puppet/type/rvm_system_ruby.rb +++ b/lib/puppet/type/rvm_system_ruby.rb @@ -12,4 +12,13 @@ desc "Should this Ruby be the system default for new terminals?" defaultto false end + + newproperty(:withopts) do + desc "Flags to compile RVM with ie: --with-openssl-dir=..." + defaultto "" + end + + newproperty(:pkg) do + desc "install package for this system ruby" + end end From 7bfa60c18001f1107fba02bab26ea1d2f17502ad Mon Sep 17 00:00:00 2001 From: Ryan Wilcox Date: Thu, 7 Mar 2013 16:09:36 -0500 Subject: [PATCH 2/3] fix syntax errors for pkg support --- lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb b/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb index 5ca31bb7..b93f1e3a 100644 --- a/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb +++ b/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb @@ -5,8 +5,8 @@ def create if resource[:pkg] - puts "rvmcmd pkg install #{resource[:pkg]}" - rvmcmd "pkg install", resource[:pkg] + #puts "rvm pkg install #{resource[:pkg]}" + rvmcmd "pkg", "install", resource[:pkg] end options = resource[:withopts] From a2906b73bfce943eaf1cebf28297c7cbc076ee5c Mon Sep 17 00:00:00 2001 From: Ryan Wilcox Date: Thu, 7 Mar 2013 16:42:15 -0500 Subject: [PATCH 3/3] get package / install options working --- README.markdown | 14 ++++++++++++++ .../provider/rvm_system_ruby/rvm_system_ruby.rb | 2 +- lib/puppet/type/rvm_system_ruby.rb | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 29051cdc..3addda1a 100644 --- a/README.markdown +++ b/README.markdown @@ -66,6 +66,20 @@ You can tell RVM to install one or more Ruby versions with: You should use the full version number. While the shorthand version may work (e.g. '1.9.2'), the provider will be unable to detect if the correct version is installed. +## Installing Ruby with options / or packages (OR: *building Rubies with a modern OpenSSL*) + +RVM has several packages that provide required libraries for OS configurations that might not have up to date components. A good example of this is OpenSSL - Ruby 2.0 (for example) depends on OpenSSL 1.x, but most OSes ship with OpenSSL 0.9.x. + +There are two new parameters you can use: + + rvm_system_ruby { + 'ruby-1.8.7': + ensure => 'present', + pkg => "openssl", + install_opts => "--with-openssl-dir=$rvm_path/usr" + } + +This will tell RVM to install the openSSL package, then compile RVM with options that point the build process to the new OpenSSL path. ## Creating Gemsets diff --git a/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb b/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb index b93f1e3a..2db37b32 100644 --- a/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb +++ b/lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb @@ -9,7 +9,7 @@ def create rvmcmd "pkg", "install", resource[:pkg] end - options = resource[:withopts] + options = resource[:install_opts] rvmcmd "install", resource[:name], options set_default if resource.value(:default_use) end diff --git a/lib/puppet/type/rvm_system_ruby.rb b/lib/puppet/type/rvm_system_ruby.rb index 841dfb4b..0919e069 100644 --- a/lib/puppet/type/rvm_system_ruby.rb +++ b/lib/puppet/type/rvm_system_ruby.rb @@ -13,12 +13,12 @@ defaultto false end - newproperty(:withopts) do + newparam(:install_opts) do desc "Flags to compile RVM with ie: --with-openssl-dir=..." defaultto "" end - newproperty(:pkg) do + newparam(:pkg) do desc "install package for this system ruby" end end