diff --git a/README.md b/README.md index 328a1a90..ef735043 100644 --- a/README.md +++ b/README.md @@ -249,14 +249,15 @@ set, use an empty string (`""`) or a value of `"system"`. A list of additional RVM system-wide Rubies to be built and installed. This list does not need to necessarily contain your default Ruby as the `rvm_default_ruby` resource will take care of installing itself. You may also -include patch info. For example: +include patch info and a rubygems version. For example: node['rvm']['rubies'] = [ "ree-1.8.7", "jruby", { - :version => '1.9.3-p125-perf', - :patch => "falcon" + 'version' => '1.9.3-p125-perf', + 'patch' => 'falcon', + 'rubygems_version' => '1.5.2' } ] @@ -388,8 +389,9 @@ The hash keys correspond to the default/system equivalents. For example: "ree-1.8.7", "jruby", { - :version => '1.9.3-p125-perf', - :patch => "falcon" + 'version' => '1.9.3-p125-perf', + 'patch' => "falcon", + 'rubygems_version' => '1.5.2' } ], 'rvmrc' => { diff --git a/libraries/chef_rvm_recipe_helpers.rb b/libraries/chef_rvm_recipe_helpers.rb index a5b25e70..c4e7f288 100644 --- a/libraries/chef_rvm_recipe_helpers.rb +++ b/libraries/chef_rvm_recipe_helpers.rb @@ -167,15 +167,18 @@ def install_rubies(opts = {}) opts[:rubies].each do |rubie| if rubie.is_a?(Hash) ruby = rubie.fetch("version") - ruby_patch = rubie.fetch("patch") + ruby_patch = rubie.fetch("patch", nil) + ruby_rubygems_version = rubie.fetch("rubygems_version", nil) else ruby = rubie ruby_patch = nil + ruby_rubygems_version = nil end rvm_ruby ruby do - patch ruby_patch - user opts[:user] + patch ruby_patch + user opts[:user] + rubygems_version ruby_rubygems_version end end diff --git a/providers/ruby.rb b/providers/ruby.rb index dce8a8cc..93969081 100644 --- a/providers/ruby.rb +++ b/providers/ruby.rb @@ -25,7 +25,7 @@ def load_current_resource @rubie = normalize_ruby_string(select_ruby(new_resource.ruby_string)) @ruby_string = new_resource.ruby_string - @rvm_env = ::RVM::ChefUserEnvironment.new(new_resource.user) + @rvm_env = ::RVM::ChefUserEnvironment.new(new_resource.user, "default", :rvm_rubygems_version => new_resource.rubygems_version) end action :install do diff --git a/resources/ruby.rb b/resources/ruby.rb index 80b49eec..cd4f29b1 100644 --- a/resources/ruby.rb +++ b/resources/ruby.rb @@ -21,9 +21,10 @@ actions :install, :uninstall, :remove -attribute :ruby_string, :kind_of => String, :name_attribute => true -attribute :user, :kind_of => String -attribute :patch, :kind_of => String +attribute :ruby_string, :kind_of => String, :name_attribute => true +attribute :user, :kind_of => String +attribute :patch, :kind_of => String +attribute :rubygems_version, :kind_of => String def initialize(*args) super