Permalink
Browse files

Update node coding style and update metadata.

  • Loading branch information...
fnichol committed May 12, 2011
1 parent 209ad02 commit 3419247e370f383b4101ecf4a8ae13ad21e01b7d
View
@@ -19,34 +19,34 @@
# limitations under the License.
#
-default[:rvm][:root_path] = "/usr/local/rvm"
-default[:rvm][:group_users] = []
-default[:rvm][:rvmrc] = Hash.new
+default['rvm']['root_path'] = "/usr/local/rvm"
+default['rvm']['group_users'] = []
+default['rvm']['rvmrc'] = Hash.new
-default[:rvm][:installer_url] = "https://rvm.beginrescueend.com/install/rvm"
+default['rvm']['installer_url'] = "https://rvm.beginrescueend.com/install/rvm"
-default[:rvm][:branch] = nil
-default[:rvm][:version] = nil
+default['rvm']['branch'] = nil
+default['rvm']['version'] = nil
-default[:rvm][:upgrade] = "none"
+default['rvm']['upgrade'] = "none"
# a hook to disable installing any default/additional rubies
-default[:rvm][:install_rubies] = "enable"
+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"
+default['rvm']['default_ruby'] = "ruby-1.9.2-p180"
# list of additional rubies that will be installed
-default[:rvm][:rubies] = []
+default['rvm']['rubies'] = []
# list of gems to be installed in global gemset of all rubies
-default[:rvm][:global_gems] = [
- { :name => "bundler" },
- { :name => "rake" }
+default['rvm']['global_gems'] = [
+ { 'name' => "bundler" },
+ { 'name' => "rake" }
]
# hash of gemsets and their list of additional gems to be installed.
-default[:rvm][:gems] = Hash.new
+default['rvm']['gems'] = Hash.new
# skip rdoc/ri generation by default on ruby installs
-default[:rvm][:skip_docs_on_install] = "enable"
+default['rvm']['skip_docs_on_install'] = "enable"
@@ -20,4 +20,4 @@
#
# rvm ruby that will be used for gem_package resources
-default[:rvm][:gem_package][:rvm_string] = node[:rvm][:default_ruby]
+default['rvm']['gem_package']['rvm_string'] = node['rvm']['default_ruby']
View
@@ -19,4 +19,4 @@
# limitations under the License.
#
-default[:rvm][:vagrant][:system_chef_solo] = "/usr/bin/chef-solo"
+default['rvm']['vagrant']['system_chef_solo'] = "/usr/bin/chef-solo"
@@ -61,7 +61,7 @@ def ruby_string
@ruby_string ||= if new_resource.respond_to?("ruby_string")
new_resource.ruby_string
else
- node[:rvm][:gem_package][:rvm_string]
+ node['rvm']['gem_package']['rvm_string']
end
end
View
@@ -7,6 +7,8 @@
recipe "rvm", "Includes all recipes"
recipe "rvm::system", "Installs system-wide RVM"
+recipe "rvm::vagrant", "An optional recipe to help if running in a Vagrant virtual machine"
+recipe "rvm::gem_package", "An experimental recipe that patches the gem_package resource"
%w{ debian ubuntu suse centos redhat fedora }.each do |os|
supports os
@@ -23,6 +25,11 @@
:type => "array",
:default => [ "node[:rvm][:default_ruby]" ]
+attribute "rvm/install_rubies",
+ :display_name => "Can enable or disable installation of a default ruby and additional rubies set attribute metadata.",
+ :description => "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).",
+ :default => "enable"
+
attribute "rvm/global_gems",
:display_name => "Global gems to be installed in all RVM rubies",
:description => "A list of gem hashes to be installed into the *global* gemset in each installed RVM ruby. The RVM global.gems files will be added to and all installed rubies will be iterated over to ensure full installation coverage.",
@@ -71,3 +78,18 @@
:description => "Additional users in rvm group that can manage rvm in a system-wide installation.",
:type => "array",
:default => []
+
+attribute "rvm/skip_docs_on_install",
+ :display_name => "Determines whether or not to skip the generation of rdoc/ri documentation when RVM calls the `gem install` command.",
+ :description => "Determines whether or not to skip the generation of rdoc/ri documentation when RVM calls the `gem install` command. In the interest of speed, these docs will not be generated by default.",
+ :default => "enable"
+
+attribute "rvm/vagrant/system_chef_solo",
+ :display_name => "If using the `vagrant` recipe, this sets the path to the package-installed `chef-solo` binary.",
+ :description => "If using the `vagrant` recipe, this sets the path to the package-installed `chef-solo` binary.",
+ :default => "/usr/bin/chef-solo"
+
+attribute "rvm/gem_package/rvm_string",
+ :display_name => "If using the `gem_package` recipe, this determines which ruby will be used by the `gem_package` resource in other cookbooks.",
+ :description => "If using the `gem_package` recipe, this determines which ruby will be used by the `gem_package` resource in other cookbooks.",
+ :default => "node[:rvm][:default_ruby]"
View
@@ -83,7 +83,7 @@ def gem_package_wrapper(exec_action, ruby_global_gemset)
#
# @oaram [Symbol] action to :create or :remove the gem from the file
def update_global_gems_file(exec_action)
- global_gems_file = "#{node[:rvm][:root_path]}/gemsets/global.gems"
+ global_gems_file = "#{node['rvm']['root_path']}/gemsets/global.gems"
gem = new_resource.package_name
if exec_action == :create
View
@@ -41,7 +41,7 @@
binaries.each do |b|
full_bin = "#{new_resource.prefix}_#{b}"
resource_name = "rvm_wrapper[#{full_bin}::#{ruby_string}]"
- script = ::File.join(::File.dirname(node[:rvm][:root_path]), "bin", full_bin)
+ script = ::File.join(::File.dirname(node['rvm']['root_path']), "bin", full_bin)
if ::File.exists?(script)
Chef::Log.debug("#{resource_name} already exists, so updating")
View
@@ -46,7 +46,7 @@
end
# install global gems
- node[:rvm][:global_gems].each do |gem|
+ node['rvm']['global_gems'].each do |gem|
rvm_global_gem gem[:name] do
version gem[:version] if gem[:version]
action gem[:action] if gem[:action]
@@ -56,7 +56,7 @@
end
# install additional gems
- node[:rvm][:gems].each_pair do |rstring, gems|
+ node['rvm']['gems'].each_pair do |rstring, gems|
rvm_environment rstring
gems.each do |gem|
View
@@ -20,4 +20,4 @@
patch_gem_package
::Chef::Log.info "gem_package resource has been patched to use provider " <<
"Chef::Provider::Package::RVMRubygems and will install gems to " <<
- "the #{node[:rvm][:gem_package][:rvm_string]} RVM Ruby."
+ "the #{node['rvm']['gem_package']['rvm_string']} RVM Ruby."
View
@@ -22,11 +22,11 @@
# - http://github.com/denimboy/xprdev/blob/master/rvm/recipes/default.rb
script_flags = ""
-if node[:rvm][:version]
- script_flags += " --version #{node[:rvm][:version]}"
+if node['rvm']['version']
+ script_flags += " --version #{node['rvm']['version']}"
end
-if node[:rvm][:branch]
- script_flags += " --branch #{node[:rvm][:branch]}"
+if node['rvm']['branch']
+ script_flags += " --branch #{node['rvm']['branch']}"
end
pkgs = %w{ sed grep tar gzip bzip2 bash curl }
@@ -44,7 +44,7 @@
execute "install system-wide RVM" do
user "root"
command <<-CODE
- bash -c "bash <( curl -Ls #{node[:rvm][:installer_url]} )#{script_flags}"
+ bash -c "bash <( curl -Ls #{node['rvm']['installer_url']} )#{script_flags}"
CODE
not_if rvm_wrap_cmd(%{type rvm | head -1 | grep -q '^rvm is a function$'})
end
@@ -56,10 +56,10 @@
mode "0644"
end
-execute "upgrade RVM to #{node[:rvm][:upgrade]}" do
+execute "upgrade RVM to #{node['rvm']['upgrade']}" do
user "root"
- command rvm_wrap_cmd(%{rvm get #{node[:rvm][:upgrade]}})
+ command rvm_wrap_cmd(%{rvm get #{node['rvm']['upgrade']}})
only_if do
- %{ latest head }.include? node[:rvm][:upgrade]
+ %{ latest head }.include? node['rvm']['upgrade']
end
end
@@ -4,11 +4,11 @@
# Local modifications will be overwritten.
#
umask g+w
-export rvm_path="<%= node[:rvm][:root_path] %>"
+export rvm_path="<%= node['rvm']['root_path'] %>"
-<% if node[:rvm][:skip_docs_on_install] == "enable" -%>
+<% if node['rvm']['skip_docs_on_install'] == "enable" -%>
export rvm_gem_options="--no-rdoc --no-ri"
<% end -%>
-<% node[:rvm][:rvmrc].each_pair do |k,v| -%>
+<% node['rvm']['rvmrc'].each_pair do |k,v| -%>
export <%= k %>=<%= v %>
<% end -%>
@@ -5,9 +5,9 @@
# Generated by Chef for <%= node[:fqdn] %>
# Local modifications will be overridden
-if [[ -d "<%= node[:rvm][:root_path] %>" ]] ; then
-export PATH="/bin:<%= node[:rvm][:root_path] %>:$PATH"
- rvm_path='<%= node[:rvm][:root_path] %>'
+if [[ -d "<%= node['rvm']['root_path'] %>" ]] ; then
+export PATH="/bin:<%= node['rvm']['root_path'] %>:$PATH"
+ rvm_path='<%= node['rvm']['root_path'] %>'
export rvm_path
unset RUBY_VERSION
unset GEM_HOME
@@ -20,4 +20,4 @@ export PATH="/bin:<%= node[:rvm][:root_path] %>:$PATH"
unset MAGLEV_HOME
fi
-exec <%= node[:rvm][:vagrant][:system_chef_solo] %> "$@"
+exec <%= node['rvm']['vagrant']['system_chef_solo'] %> "$@"

0 comments on commit 3419247

Please sign in to comment.