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