##// END OF EJS Templates
work around "rake db:create:all" error on JRuby SQLite3...
Toshi MARUYAMA -
r12026:882c4495c08b
parent child
Show More
@@ -1,63 +1,66
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 Rake::Task["db:create:all"].invoke
16 database = ENV['DATABASE_ADAPTER']
17 unless Object.const_defined?(:JRUBY_VERSION) && database =~ /sqlite3/
18 Rake::Task["db:create:all"].invoke
19 end
17 20 Rake::Task["db:migrate"].invoke
18 21 Rake::Task["db:schema:dump"].invoke
19 22 Rake::Task["test:scm:setup:all"].invoke
20 23 Rake::Task["test:scm:update"].invoke
21 24 end
22 25
23 26 desc "Build Redmine"
24 27 task :build do
25 28 Rake::Task["test"].invoke
26 29 # Rake::Task["test:ui"].invoke if RUBY_VERSION >= '1.9.3'
27 30 end
28 31
29 32 desc "Finish the build"
30 33 task :teardown do
31 34 end
32 35 end
33 36
34 37 desc "Creates database.yml for the CI server"
35 38 file 'config/database.yml' do
36 39 require 'yaml'
37 40 database = ENV['DATABASE_ADAPTER']
38 41 ruby = ENV['RUBY_VER'].gsub('.', '').gsub('-', '')
39 42 branch = ENV['BRANCH'].gsub('.', '').gsub('-', '')
40 43 dev_db_name = "ci_#{branch}_#{ruby}_dev"
41 44 test_db_name = "ci_#{branch}_#{ruby}_test"
42 45
43 46 case database
44 47 when 'mysql'
45 48 dev_conf = {'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'), 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins', 'encoding' => 'utf8'}
46 49 test_conf = dev_conf.merge('database' => test_db_name)
47 50 when 'postgresql'
48 51 dev_conf = {'adapter' => 'postgresql', 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins'}
49 52 test_conf = dev_conf.merge('database' => test_db_name)
50 53 when 'sqlite3'
51 54 dev_conf = {'adapter' => 'sqlite3', 'database' => "db/#{dev_db_name}.sqlite3"}
52 55 test_conf = dev_conf.merge('database' => "db/#{test_db_name}.sqlite3")
53 56 when 'sqlserver'
54 57 dev_conf = {'adapter' => 'sqlserver', 'database' => dev_db_name, 'host' => 'mssqlserver', 'port' => 1433, 'username' => 'jenkins', 'password' => 'jenkins'}
55 58 test_conf = dev_conf.merge('database' => test_db_name)
56 59 else
57 60 abort "Unknown database"
58 61 end
59 62
60 63 File.open('config/database.yml', 'w') do |f|
61 64 f.write YAML.dump({'development' => dev_conf, 'test' => test_conf})
62 65 end
63 66 end
General Comments 0
You need to be logged in to leave comments. Login now