Skip to content

Commit

Permalink
Add rvm/install_rubies attr as the hook to disable ruby installs.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnichol committed Feb 26, 2011
1 parent 450e4be commit 1667e28
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
17 changes: 14 additions & 3 deletions README.md
Expand Up @@ -25,8 +25,8 @@ built as a pre-requisite. The value can also contain a gemset in the form of
**Note:** a fully qualified RVM string name needs to be used, which can be
found when running `rvm list known`.

The default is `ruby-1.9.2-p180`. To disable a ruby form being installed, set this
attribute to `nil`.
The default is `ruby-1.9.2-p180`. To disable a default ruby from being
installed, see the `install_rubies` attribute.

## `rubies`

Expand All @@ -39,7 +39,18 @@ care of installing itself. For example:
**Note:** a fully qualified RVM string name needs to be used, which can be
found when running `rvm list known`.

The default is an empty array.
The default is an empty array. To disable a default ruby from being
installed, see the `install_rubies` attribute.

## `install_rubies`

Can enable or disable installation of a default ruby and additional rubies set
attribute metadata. The primary use case for this attribute is when you don't
want any rubies installed (but you want RVM installed). To do so:

node[:rvm][:install_rubies] = "disable"

The default is `enable`.

## `global_gems`

Expand Down
3 changes: 3 additions & 0 deletions attributes/default.rb
Expand Up @@ -30,6 +30,9 @@

default[:rvm][:upgrade] = "none"

# a hook to disable installing any default/additional rubies
default[:rvm][:install_rubies] = "enable"

# ruby that will get installed and set to `rvm use default`.
default[:rvm][:default_ruby] = "ruby-1.9.2-p180"

Expand Down
12 changes: 6 additions & 6 deletions recipes/default.rb
Expand Up @@ -36,14 +36,14 @@

include_recipe "rvm::system"

# set a default ruby
unless node[:rvm][:default_ruby].nil?
if node[:rvm][:install_rubies] == "enable"
# set a default ruby
rvm_default_ruby node[:rvm][:default_ruby]
end

# install additional rubies
node[:rvm][:rubies].each do |rubie|
rvm_ruby rubie
# install additional rubies
node[:rvm][:rubies].each do |rubie|
rvm_ruby rubie
end
end

# install global gems
Expand Down

0 comments on commit 1667e28

Please sign in to comment.