Skip to content

Commit

Permalink
Merge pull request #100 from getaroom/rubygems_version
Browse files Browse the repository at this point in the history
Add rubygems_version attribute to rvm_ruby resource
  • Loading branch information
fnichol committed Jan 15, 2013
2 parents 6387cad + dd1ef22 commit cf8ed73
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
]

Expand Down Expand Up @@ -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' => {
Expand Down
9 changes: 6 additions & 3 deletions libraries/chef_rvm_recipe_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion providers/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions resources/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cf8ed73

Please sign in to comment.