Created
August 6, 2010 19:54
-
-
Save meineerde/511894 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| desc "Dump enviromnent information" | |
| task :dump_env do | |
| dump = lambda do |f| | |
| f.puts "$ ruby -v" | |
| f.puts `ruby -v` | |
| f.puts | |
| f.puts "$ gem -v" | |
| f.puts `gem -v` | |
| f.puts | |
| f.puts "$ gem list" | |
| f.puts `gem list` | |
| end | |
| out = ENV['CC_BUILD_ARTIFACTS'] | |
| if out | |
| File.open(out + "/env.log", "w") do |f| | |
| dump.call(f) | |
| end | |
| else | |
| dump.call($stdout) | |
| end | |
| end | |
| task :test_env do | |
| RAILS_ENV = 'test' | |
| end | |
| task :real_cruise => [:dump_env, :test_env, "db:migrate", :test] | |
| desc "Execute ci tasks" | |
| task :cruise do | |
| path = File.expand_path(".").split("/").find {|f| f =~ /redmine/} | |
| ruby_version = path.split("_").first.gsub(/-/, ".") | |
| case ruby_version | |
| when 'jruby' | |
| ruby_version = 'jruby-1.5.0' | |
| end | |
| database = path.split("_").last | |
| if database != "sqlite3" | |
| if path =~ /trunk/ | |
| database += "_trunk" | |
| elsif path =~ /1-0/ | |
| database += "_1_0" | |
| elsif path =~ /0-9/ | |
| database += "_0_9" | |
| else | |
| warn "Not sure, which database setting should be used" | |
| end | |
| end | |
| ENV["DATABASE_SETTING"] = database | |
| sh "rvm #{ruby_version} rake real_cruise" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment