Skip to content

Instantly share code, notes, and snippets.

@ms-ati
Created March 24, 2011 18:13
Show Gist options
  • Save ms-ati/885557 to your computer and use it in GitHub Desktop.
Save ms-ati/885557 to your computer and use it in GitHub Desktop.
Updated to replace system-wide installation, which was removed, with install-as-root
#
# Installs ree using rvm.
#
require_recipe "rvm"
bash "Install ree in rvm" do
user "root"
code "rvm install ree"
not_if "rvm list | grep ree"
end
#
# Install RVM system wide
# See: http://www.agileweboperations.com/chef-rvm-ruby-enterprise-edition-as-default-ruby/
#
include_recipe "build-essential"
include_recipe "helper"
class Chef::Resource
include FileHelpers
end
%w(curl git-core libreadline5-dev zlib1g-dev libssl-dev libxml2-dev libxslt1-dev).each do |pkg|
package pkg
end
bash "install RVM" do
user "root"
code "bash < <( curl -L http://rvm.beginrescueend.com/releases/rvm-install-head )"
not_if { File.exists?("/usr/local/bin/rvm") }
end
cookbook_file "/etc/profile.d/rvm.sh" do
mode "644"
end
# NOTE (2011-03-09, msiegel):
# The following block ensures that RVM ruby is used by all sudo calls from Vagrant.
# Taken from this gist: https://gist.github.com/803820
# Found from this discussion: http://groups.google.com/group/vagrant-up/browse_thread/thread/dd419116202e54f4
#
ruby_block "Configure RVM for vagrant" do
block do
file_append("/root/.bashrc", "[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'")
file_append("/root/.bashrc", "alias sudo=rvmsudo")
file_append("/etc/profile", "alias sudo=rvmsudo")
end
end
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Skipping bash[install RVM] due to not_if
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Processing cookbook_file[/etc/profile.d/rvm.sh] on vagrantup.com
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: cookbook_file[/etc/profile.d/rvm.sh] using Chef::Provider::CookbookFile
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Processing ruby_block[Configure RVM for vagrant] on vagrantup.com
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: ruby_block[Configure RVM for vagrant] using Chef::Provider::RubyBlock
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Processing bash[Install ree in rvm] on vagrantup.com
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Executing rvm list | grep ree
: stdout
[default] [Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: ---- Begin output of rvm list | grep ree ----
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: STDOUT:
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: STDERR: sh: rvm: Permission denied
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: ---- End output of rvm list | grep ree ----
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Ran rvm list | grep ree returned 1
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: bash[Install ree in rvm] using Chef::Provider::Script
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Executing "bash" "/tmp/chef-script20110324-3905-2nawng-0"
[default] [Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: ---- Begin output of "bash" "/tmp/chef-script20110324-3905-2nawng-0" ----
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: STDOUT:
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: STDERR: /tmp/chef-script20110324-3905-2nawng-0: line 1: rvm: command not found
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: ---- End output of "bash" "/tmp/chef-script20110324-3905-2nawng-0" ----
[Thu, 24 Mar 2011 11:11:48 -0700] DEBUG: Ran "bash" "/tmp/chef-script20110324-3905-2nawng-0" returned 127
[Thu, 24 Mar 2011 11:11:48 -0700] ERROR: bash[Install ree in rvm] (/tmp/vagrant-chef/cookbooks-0/rvm/recipes/ree.rb:7:in `from_file') had an error:
"bash" "/tmp/chef-script20110324-3905-2nawng-0" returned 127, expected 0
---- Begin output of "bash" "/tmp/chef-script20110324-3905-2nawng-0" ----
STDOUT: STDERR: /tmp/chef-script20110324-3905-2nawng-0: line 1: rvm: command not found
---- End output of "bash" "/tmp/chef-script20110324-3905-2nawng-0" ----
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/mixin/command.rb:184:in `handle_command_failures'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment