Mercurial > hg > soundsoftware-site
comparison .svn/pristine/bf/bffc97455f7192a4c50a5daa226945f5e048b46b.svn-base @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
1 desc "Run the Continous Integration tests for Redmine" | |
2 task :ci do | |
3 # RAILS_ENV and ENV[] can diverge so force them both to test | |
4 ENV['RAILS_ENV'] = 'test' | |
5 RAILS_ENV = 'test' | |
6 Rake::Task["ci:setup"].invoke | |
7 Rake::Task["ci:build"].invoke | |
8 Rake::Task["ci:teardown"].invoke | |
9 end | |
10 | |
11 namespace :ci do | |
12 desc "Setup Redmine for a new build" | |
13 task :setup do | |
14 Rake::Task["tmp:clear"].invoke | |
15 Rake::Task["log:clear"].invoke | |
16 Rake::Task["db:create:all"].invoke | |
17 Rake::Task["db:migrate"].invoke | |
18 Rake::Task["db:schema:dump"].invoke | |
19 Rake::Task["test:scm:setup:all"].invoke | |
20 Rake::Task["test:scm:update"].invoke | |
21 end | |
22 | |
23 desc "Build Redmine" | |
24 task :build do | |
25 Rake::Task["test"].invoke | |
26 #Rake::Task["test:ui"].invoke unless RUBY_VERSION < '1.9' | |
27 end | |
28 | |
29 desc "Finish the build" | |
30 task :teardown do | |
31 end | |
32 end | |
33 | |
34 desc "Creates database.yml for the CI server" | |
35 file 'config/database.yml' do | |
36 require 'yaml' | |
37 database = ENV['DATABASE_ADAPTER'] | |
38 ruby = ENV['RUBY_VER'].gsub('.', '').gsub('-', '') | |
39 branch = ENV['BRANCH'].gsub('.', '').gsub('-', '') | |
40 dev_db_name = "ci_#{branch}_#{ruby}_dev" | |
41 test_db_name = "ci_#{branch}_#{ruby}_test" | |
42 | |
43 case database | |
44 when 'mysql' | |
45 dev_conf = {'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'), 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins', 'encoding' => 'utf8'} | |
46 test_conf = dev_conf.merge('database' => test_db_name) | |
47 when 'postgresql' | |
48 dev_conf = {'adapter' => 'postgresql', 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins'} | |
49 test_conf = dev_conf.merge('database' => test_db_name) | |
50 when 'sqlite3' | |
51 dev_conf = {'adapter' => 'sqlite3', 'database' => "db/#{dev_db_name}.sqlite3"} | |
52 test_conf = dev_conf.merge('database' => "db/#{test_db_name}.sqlite3") | |
53 when 'sqlserver' | |
54 dev_conf = {'adapter' => 'sqlserver', 'database' => dev_db_name, 'host' => 'mssqlserver', 'port' => 1433, 'username' => 'jenkins', 'password' => 'jenkins'} | |
55 test_conf = dev_conf.merge('database' => test_db_name) | |
56 else | |
57 abort "Unknown database" | |
58 end | |
59 | |
60 File.open('config/database.yml', 'w') do |f| | |
61 f.write YAML.dump({'development' => dev_conf, 'test' => test_conf}) | |
62 end | |
63 end |