##// END OF EJS Templates
ci.rake: code format cleanup...
Toshi MARUYAMA -
r12027:0707c7a12de8
parent child
Show More
@@ -1,66 +1,74
1 1 desc "Run the Continous Integration tests for Redmine"
2 2 task :ci do
3 3 # RAILS_ENV and ENV[] can diverge so force them both to test
4 4 ENV['RAILS_ENV'] = 'test'
5 5 RAILS_ENV = 'test'
6 6 Rake::Task["ci:setup"].invoke
7 7 Rake::Task["ci:build"].invoke
8 8 Rake::Task["ci:teardown"].invoke
9 9 end
10 10
11 11 namespace :ci do
12 12 desc "Setup Redmine for a new build"
13 13 task :setup do
14 14 Rake::Task["tmp:clear"].invoke
15 15 Rake::Task["log:clear"].invoke
16 16 database = ENV['DATABASE_ADAPTER']
17 17 unless Object.const_defined?(:JRUBY_VERSION) && database =~ /sqlite3/
18 18 Rake::Task["db:create:all"].invoke
19 19 end
20 20 Rake::Task["db:migrate"].invoke
21 21 Rake::Task["db:schema:dump"].invoke
22 22 Rake::Task["test:scm:setup:all"].invoke
23 23 Rake::Task["test:scm:update"].invoke
24 24 end
25 25
26 26 desc "Build Redmine"
27 27 task :build do
28 28 Rake::Task["test"].invoke
29 29 # Rake::Task["test:ui"].invoke if RUBY_VERSION >= '1.9.3'
30 30 end
31 31
32 32 desc "Finish the build"
33 33 task :teardown do
34 34 end
35 35 end
36 36
37 37 desc "Creates database.yml for the CI server"
38 38 file 'config/database.yml' do
39 39 require 'yaml'
40 40 database = ENV['DATABASE_ADAPTER']
41 41 ruby = ENV['RUBY_VER'].gsub('.', '').gsub('-', '')
42 42 branch = ENV['BRANCH'].gsub('.', '').gsub('-', '')
43 43 dev_db_name = "ci_#{branch}_#{ruby}_dev"
44 44 test_db_name = "ci_#{branch}_#{ruby}_test"
45 45
46 46 case database
47 47 when 'mysql'
48 dev_conf = {'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'), 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins', 'encoding' => 'utf8'}
48 dev_conf = {'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'),
49 'database' => dev_db_name, 'host' => 'localhost',
50 'username' => 'jenkins', 'password' => 'jenkins',
51 'encoding' => 'utf8'}
49 52 test_conf = dev_conf.merge('database' => test_db_name)
50 53 when 'postgresql'
51 dev_conf = {'adapter' => 'postgresql', 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins'}
54 dev_conf = {'adapter' => 'postgresql', 'database' => dev_db_name,
55 'host' => 'localhost',
56 'username' => 'jenkins', 'password' => 'jenkins'}
52 57 test_conf = dev_conf.merge('database' => test_db_name)
53 58 when 'sqlite3'
54 dev_conf = {'adapter' => 'sqlite3', 'database' => "db/#{dev_db_name}.sqlite3"}
59 dev_conf = {'adapter' => 'sqlite3',
60 'database' => "db/#{dev_db_name}.sqlite3"}
55 61 test_conf = dev_conf.merge('database' => "db/#{test_db_name}.sqlite3")
56 62 when 'sqlserver'
57 dev_conf = {'adapter' => 'sqlserver', 'database' => dev_db_name, 'host' => 'mssqlserver', 'port' => 1433, 'username' => 'jenkins', 'password' => 'jenkins'}
63 dev_conf = {'adapter' => 'sqlserver', 'database' => dev_db_name,
64 'host' => 'mssqlserver', 'port' => 1433,
65 'username' => 'jenkins', 'password' => 'jenkins'}
58 66 test_conf = dev_conf.merge('database' => test_db_name)
59 67 else
60 68 abort "Unknown database"
61 69 end
62 70
63 71 File.open('config/database.yml', 'w') do |f|
64 72 f.write YAML.dump({'development' => dev_conf, 'test' => test_conf})
65 73 end
66 74 end
General Comments 0
You need to be logged in to leave comments. Login now