Sha256: c8df4ebd86932f1a7fd9183bdca44585286b5a34b27ce2d45962b0739d01d312

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

#
# Cookbook Name:: rvm
# Recipe:: system
#

script_flags = ""
if node['rvm']['version']
  script_flags += " --version #{node['rvm']['version']}"
end
if node['rvm']['branch']
  script_flags += " --branch #{node['rvm']['branch']}"
end

upgrade_strategy = if node['rvm']['upgrade'].nil? || node['rvm']['upgrade'] == false
  "none"
else
  node['rvm']['upgrade']
end

script "install user RVM" do
  interpreter "bash"
  code <<-CODE
    source ~/.bash_profile
    `type rvm | head -1 | grep -q '^rvm is a function$'`
    if [ $? -ne 0 ]; then
      bash -c "bash <( curl -s #{node['rvm']['installer_url']} )#{script_flags}"
    fi
  CODE
  not_if rvm_wrap_cmd(%{type rvm | head -1 | grep -q '^rvm is a function$'})
end

execute "setup rvm script sourcing in ~/.bash_profile" do
  command "echo '[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && . \"$HOME/.rvm/scripts/rvm\" # Load RVM function' >> ~/.bash_profile"
  not_if  "grep -q '/.rvm/scripts/rvm' ~/.bash_profile"
end

template "#{ENV['HOME']}/.rvmrc" do
  mode   0700
  owner  ENV['USER']
  group  Etc.getgrgid(Process.gid).name
  source  "rvmrc.erb"
end

execute "upgrade RVM to #{upgrade_strategy}" do
  command   rvm_wrap_cmd(%{rvm get #{upgrade_strategy}})
  only_if   { %w{ latest head }.include? upgrade_strategy }
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
flombe-0.1.0.12 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.11 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.10 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.9 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.8 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.7 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.6 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.5 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.4 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.3 cookbooks/rvm/recipes/user.rb
flombe-0.1.0.2 cookbooks/rvm/recipes/user.rb