Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rubygems_version attribute to rvm_ruby resource #100

Merged
merged 1 commit into from
Jan 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,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 @@ -375,8 +376,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 @@ -155,15 +155,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