Skip to content

Commit

Permalink
First versions that is able to run all the tests, except for many pos…
Browse files Browse the repository at this point in the history
…tgresql tests, they all pass
  • Loading branch information
jeroenvandijk committed Mar 17, 2010
1 parent 632e88f commit a527a0f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
1 change: 1 addition & 0 deletions Vagrantfile
Expand Up @@ -3,6 +3,7 @@ Vagrant::Config.run do |config|

config.vm.customize do |vm|
vm.name = "Rails Test Environment"
vm.memory = 512
end

config.vm.share_folder('rails', 'rails', 'rails')
Expand Down
23 changes: 15 additions & 8 deletions cookbooks/rails_test_suite/recipes/default.rb
Expand Up @@ -4,16 +4,23 @@
rvmsudo = "#{rvm_home}/bin/rvmsudo"
rvm_gem = "#{rvm_home}/rubies/ruby-1.8.7-p249/bin/gem"

execute "bundler" do
command "#{rvmsudo} #{rvm_gem} install bundler"
execute "Install bundler and rake gems" do
command "#{rvmsudo} #{rvm_gem} install bundler rake"
user "vagrant"
group "vagrant"
end

execute "Install Rails core gem dependencies" do
command "#{rvm} 1.8.7 && #{rvmsudo} #{rvm_home}/rubies/ruby-1.8.7-p249/lib/ruby/gems/1.8/bin/bundle install"
cwd "#{home}/rails"
user "vagrant"
bundle_command = "#{rvm} 1.8.7 && #{rvm_home}/rubies/ruby-1.8.7-p249/lib/ruby/gems/1.8/bin/bundle install vendor"

bundle_dirs = [ "#{home}/rails" ] +
%w(activesupport activemodel actionpack actionmailer activeresource activerecord railties).map { |dir| "#{home}/rails/#{dir}" }

bundle_dirs.each do |dir|
execute "Run bundle install for #{dir}" do
command bundle_command
cwd dir
user "vagrant"
end
end

remote_file "/tmp/rails_mysql_user_grants.sql"
Expand All @@ -30,11 +37,11 @@
end

rvm_rake = "#{rvm_home}/gems/ruby-1.8.7-p249%global/bin/rake"
rake = "#{rvm} 1.8.7 && #{rvmsudo} #{rvm_rake}"
rake = "#{rvm} 1.8.7 && #{rvm_rake}"
activerecord_path = "#{home}/rails/activerecord"

%w(mysql postgresql).each do |database|
# First we are gonna drop the database to make sure creating succeeds
# First we are gonna drop the database to make sure creating on succeeds
execute "Drop #{database} databases" do
user "vagrant"
cwd activerecord_path
Expand Down
24 changes: 13 additions & 11 deletions cookbooks/rvm/recipes/default.rb
@@ -1,5 +1,12 @@
home = "/home/vagrant"
rvm_home = "#{home}/.rvm"
rvm = "#{rvm_home}/bin/rvm"

ruby_version = "1.8.7" # Add more ruby versions here?

bash "install rvm" do
user "vagrant"
# Using the example command from http://rvm.beginrescueend.com
code <<-EOH
mkdir -p ~/.rvm/src/
cd ~/.rvm/src
Expand All @@ -8,35 +15,30 @@
cd rvm
./install
EOH
not_if { File.exists?("/home/vagrant/.rvm") }
not_if { File.exists?(rvm_home) }
end

remote_file "/home/vagrant/.bash_profile" do
remote_file "#{home}/.bash_profile" do
source "bash_profile"
owner "vagrant"
group "vagrant"
mode 0777
end

ruby_version = "1.8.7"
rvm_bin = "/home/vagrant/.rvm/bin/rvm"

execute "install ruby #{ruby_version}" do
user "vagrant"
command "#{rvm_bin} install #{ruby_version}"
not_if "ls /home/vagrant/.rvm/rubies | grep ruby-#{ruby_version}"
command "#{rvm} install #{ruby_version}"
not_if "ls #{rvm_home}/rubies | grep ruby-#{ruby_version}"
end

rvm = "/home/vagrant/.rvm/bin/rvm"
rvmsudo = "#{rvm} 1.8.7 && /home/vagrant/.rvm/bin/rvmsudo"
rvmsudo = "#{rvm} 1.8.7 && #{rvm_home}/bin/rvmsudo"

# Does this work?
execute "Update ruby gems" do
user "vagrant"
command "#{rvmsudo} gem update --system"
end

execute "set ruby #{ruby_version} as default" do
user "vagrant"
command "#{rvm_bin} --default #{ruby_version}"
command "#{rvm} --default #{ruby_version}"
end

0 comments on commit a527a0f

Please sign in to comment.