-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update cookbooks to make everything work again, faster and including …
…new rubies
- Loading branch information
1 parent
c45f25c
commit 5fc70a1
Showing
8 changed files
with
107 additions
and
41 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
define :rvm_default do | ||
ruby_version = RVM.ruby_version params[:name] | ||
rvm_ruby = RVM::Ruby.new params[:name] | ||
|
||
# rvm_default | ||
execute "set ruby #{ruby_version} as default" do | ||
execute "set ruby #{rvm_ruby.version} as default" do | ||
user "vagrant" | ||
command "/home/vagrant/.rvm/bin/rvm --default #{ruby_version}" | ||
command "/home/vagrant/.rvm/bin/rvm --default #{rvm_ruby.version}" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
define :rvm_install do | ||
ruby_version = RVM.ruby_version params[:name] | ||
|
||
require_recipe "java" if ruby_version =~ /^jruby/ | ||
|
||
package "libreadline5-dev" if ruby_version =~ /^ree/ | ||
|
||
require_recipe "mono" if ruby_version =~ /^ironruby/ | ||
|
||
execute "install ruby #{ruby_version}" do | ||
user node[:rvm][:user] | ||
command "#{node[:rvm][:bin]}/rvm install #{ruby_version}" | ||
not_if "ls #{node[:rvm][:home]}/rubies | grep #{ruby_version}" | ||
rvm_ruby = RVM::Ruby.new params[:name] | ||
|
||
rvm_ruby.recipes.each do |recipe| | ||
require_recipe recipe | ||
end | ||
|
||
rvm_use ruby_version | ||
rvm_ruby.packages.each do |pkg| | ||
package pkg | ||
end | ||
|
||
if ruby_version =~ /^ruby/ | ||
# part of the rvm_install is the open ssl recompilation (from http://cjohansen.no/en/ruby/ruby_version_manager_ubuntu_and_openssl) | ||
package "libssl-dev" | ||
|
||
# FIXME the command below does not work if the patch version is not added to the ruby version, e.g. ruby-1.8.7 or ruby-1.9.2 will give an error | ||
execute "Fix install openssl for RVM #{ruby_version}" do | ||
user "vagrant" | ||
command "cd #{node[:rvm][:home]}/src/#{ruby_version}/ext/openssl && ruby extconf.rb && make install" | ||
not_if { File.exist?("#{node[:rvm][:home]}/.rvm/rubies/#{ruby_version}/lib/ruby/site_ruby/1.8/openssl") } # does not work for 1.9.1 | ||
end | ||
execute "install ruby #{rvm_ruby.version}" do | ||
user node[:rvm][:user] | ||
command "#{node[:rvm][:bin]}/rvm install #{rvm_ruby.version}" | ||
not_if "ls #{node[:rvm][:home]}/rubies | grep #{rvm_ruby.version}" | ||
end | ||
|
||
rvm_use rvm_ruby.version | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,74 @@ | ||
class RVM | ||
def self.ruby_version(name) | ||
name.strip =~ /^\d/ ? "ruby-#{name}" : name | ||
module RVM | ||
class Ruby | ||
attr_accessor :name | ||
|
||
def initialize(name) | ||
@name = name | ||
end | ||
|
||
# Based on `rvm notes`, make sure you run it on the environment you are | ||
# targetting. This is just targetted at ubuntu. Would be better if we could | ||
# get this list easily by running a rvm command. | ||
def packages | ||
mri_packages = %w(build-essential bison openssl libreadline6 libreadline6-dev curl git-core | ||
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev | ||
sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev) | ||
|
||
if ree? || mri? | ||
mri_packages | ||
elsif ruby_head? | ||
mri_packages + %w(subversion) | ||
elsif jruby_head? | ||
%w(ant openjdk-6-jdk) | ||
elsif jruby? | ||
%w(g++ openjdk-6-jre-headless) | ||
elsif ironruby? | ||
%w(mono-2.0-devel) | ||
else | ||
[] | ||
end | ||
end | ||
|
||
def recipes | ||
if jruby? | ||
%w(java) | ||
else | ||
[] | ||
end | ||
end | ||
|
||
def version | ||
name.strip =~ /^\d/ ? "ruby-#{name}" : name | ||
end | ||
|
||
def mri? | ||
version =~ /^ruby/ | ||
end | ||
|
||
def requires_java? | ||
version =~ /^jruby/ | ||
end | ||
|
||
def ree? | ||
version =~ /^ree/ | ||
end | ||
|
||
def ironruby? | ||
version =~ /^ironruby/ | ||
end | ||
|
||
def ruby_head? | ||
version =~ /^ruby-head$/ | ||
end | ||
|
||
def jruby_head? | ||
version =~ /^jruby-head$/ | ||
end | ||
|
||
def jruby? | ||
version =~ /^jruby/ | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters