2008-08-24 14:25:05 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
require 'fileutils'
|
|
|
|
include FileUtils
|
|
|
|
|
2009-11-10 23:18:21 +00:00
|
|
|
def root_dir
|
|
|
|
@root_dir ||= File.expand_path('../..', __FILE__)
|
|
|
|
end
|
|
|
|
|
|
|
|
def rake(*tasks)
|
2010-02-02 01:35:15 +00:00
|
|
|
tasks.each do |task|
|
|
|
|
cmd = "bundle exec rake #{task}"
|
|
|
|
puts "Running command: #{cmd}"
|
|
|
|
return false unless system(cmd)
|
|
|
|
end
|
2009-11-11 01:13:43 +00:00
|
|
|
true
|
2009-11-10 23:18:21 +00:00
|
|
|
end
|
2008-08-24 14:25:05 +00:00
|
|
|
|
2009-11-10 23:18:21 +00:00
|
|
|
puts "[CruiseControl] Rails build"
|
2008-08-24 14:25:05 +00:00
|
|
|
build_results = {}
|
|
|
|
|
2010-02-01 23:04:03 +00:00
|
|
|
# Install required version of bundler.
|
2010-03-28 22:46:45 +00:00
|
|
|
bundler_install_cmd = "sudo gem install bundler --no-ri --no-rdoc"
|
2010-02-04 22:57:13 +00:00
|
|
|
puts "Running command: #{bundler_install_cmd}"
|
|
|
|
build_results[:install_bundler] = system bundler_install_cmd
|
2008-08-24 14:25:05 +00:00
|
|
|
|
2009-10-27 08:55:17 +00:00
|
|
|
cd root_dir do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Bundling RubyGems"
|
|
|
|
puts
|
2010-03-15 18:01:16 +00:00
|
|
|
build_results[:bundle] = system 'sudo rm -rf ~/.bundle; env CI=1 bundle install'
|
2009-10-27 08:55:17 +00:00
|
|
|
end
|
|
|
|
|
2008-08-24 14:25:05 +00:00
|
|
|
cd "#{root_dir}/activesupport" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveSupport"
|
|
|
|
puts
|
2009-11-11 01:19:39 +00:00
|
|
|
build_results[:activesupport] = rake 'test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:activesupport_isolated] = rake 'test:isolated'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
2009-11-11 00:08:02 +00:00
|
|
|
cd "#{root_dir}/railties" do
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2009-11-11 00:08:02 +00:00
|
|
|
puts "[CruiseControl] Building RailTies"
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2009-11-11 01:19:39 +00:00
|
|
|
build_results[:railties] = rake 'test'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
2009-11-11 00:08:02 +00:00
|
|
|
cd "#{root_dir}/actionpack" do
|
2008-08-26 10:14:07 +00:00
|
|
|
puts
|
2009-11-11 00:08:02 +00:00
|
|
|
puts "[CruiseControl] Building ActionPack"
|
2008-08-26 10:14:07 +00:00
|
|
|
puts
|
2009-11-11 01:19:39 +00:00
|
|
|
build_results[:actionpack] = rake 'test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:actionpack_isolated] = rake 'test:isolated'
|
2008-08-26 10:14:07 +00:00
|
|
|
end
|
2008-08-24 14:25:05 +00:00
|
|
|
|
2009-11-11 00:08:02 +00:00
|
|
|
cd "#{root_dir}/actionmailer" do
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2009-11-11 00:08:02 +00:00
|
|
|
puts "[CruiseControl] Building ActionMailer"
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2009-11-11 01:19:39 +00:00
|
|
|
build_results[:actionmailer] = rake 'test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:actionmailer_isolated] = rake 'test:isolated'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
cd "#{root_dir}/activemodel" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveModel"
|
|
|
|
puts
|
2009-11-11 01:19:39 +00:00
|
|
|
build_results[:activemodel] = rake 'test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:activemodel_isolated] = rake 'test:isolated'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
2009-01-07 03:42:53 +00:00
|
|
|
rm_f "#{root_dir}/activeresource/debug.log"
|
2008-08-24 14:25:05 +00:00
|
|
|
cd "#{root_dir}/activeresource" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveResource"
|
|
|
|
puts
|
2009-11-11 01:19:39 +00:00
|
|
|
build_results[:activeresource] = rake 'test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:activeresource_isolated] = rake 'test:isolated'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
2009-11-11 00:08:02 +00:00
|
|
|
rm_f "#{root_dir}/activerecord/debug.log"
|
|
|
|
cd "#{root_dir}/activerecord" do
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2009-11-11 00:08:02 +00:00
|
|
|
puts "[CruiseControl] Building ActiveRecord with MySQL"
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2010-02-06 00:17:06 +00:00
|
|
|
build_results[:activerecord_mysql] = rake 'mysql:rebuild_databases', 'mysql:test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:activerecord_mysql_isolated] = rake 'mysql:rebuild_databases', 'mysql:isolated_test'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
2009-11-11 00:08:02 +00:00
|
|
|
cd "#{root_dir}/activerecord" do
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2009-11-11 00:08:02 +00:00
|
|
|
puts "[CruiseControl] Building ActiveRecord with PostgreSQL"
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2010-02-06 00:17:06 +00:00
|
|
|
build_results[:activerecord_postgresql8] = rake 'postgresql:rebuild_databases', 'postgresql:test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:activerecord_postgresql8_isolated] = rake 'postgresql:rebuild_databases', 'postgresql:isolated_test'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
2009-11-11 00:08:02 +00:00
|
|
|
cd "#{root_dir}/activerecord" do
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2009-11-11 00:08:02 +00:00
|
|
|
puts "[CruiseControl] Building ActiveRecord with SQLite 3"
|
2008-08-24 14:25:05 +00:00
|
|
|
puts
|
2010-02-06 00:17:06 +00:00
|
|
|
build_results[:activerecord_sqlite3] = rake 'sqlite3:test'
|
2010-03-18 18:36:53 +00:00
|
|
|
# build_results[:activerecord_sqlite3_isolated] = rake 'sqlite3:isolated_test'
|
2008-08-24 14:25:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Build environment:"
|
|
|
|
puts "[CruiseControl] #{`cat /etc/issue`}"
|
|
|
|
puts "[CruiseControl] #{`uname -a`}"
|
|
|
|
puts "[CruiseControl] #{`ruby -v`}"
|
|
|
|
puts "[CruiseControl] #{`mysql --version`}"
|
|
|
|
puts "[CruiseControl] #{`pg_config --version`}"
|
|
|
|
puts "[CruiseControl] SQLite3: #{`sqlite3 -version`}"
|
2009-02-04 17:29:00 +00:00
|
|
|
`gem env`.each_line {|line| print "[CruiseControl] #{line}"}
|
2010-02-06 00:18:26 +00:00
|
|
|
puts "[CruiseControl] Bundled gems:"
|
|
|
|
`bundle show`.each_line {|line| print "[CruiseControl] #{line}"}
|
2008-08-24 14:25:05 +00:00
|
|
|
puts "[CruiseControl] Local gems:"
|
2009-02-04 17:29:00 +00:00
|
|
|
`gem list`.each_line {|line| print "[CruiseControl] #{line}"}
|
2008-08-24 14:25:05 +00:00
|
|
|
|
|
|
|
failures = build_results.select { |key, value| value == false }
|
|
|
|
|
|
|
|
if failures.empty?
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Rails build finished sucessfully"
|
|
|
|
exit(0)
|
|
|
|
else
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Rails build FAILED"
|
|
|
|
puts "[CruiseControl] Failed components: #{failures.map { |component| component.first }.join(', ')}"
|
|
|
|
exit(-1)
|
|
|
|
end
|
|
|
|
|