mirror of https://github.com/rails/rails
Make sure that the build/drop database rake tasks take account of the test/config.yml config
This commit is contained in:
parent
5e21247131
commit
499dec0102
|
@ -4,8 +4,7 @@ require 'rake/packagetask'
|
|||
require 'rubygems/package_task'
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__)) + "/test/config"
|
||||
|
||||
MYSQL_DB_USER = 'rails'
|
||||
require File.expand_path(File.dirname(__FILE__)) + "/test/support/config"
|
||||
|
||||
def run_without_aborting(*tasks)
|
||||
errors = []
|
||||
|
@ -82,14 +81,16 @@ task :test_sqlite3 => [
|
|||
namespace :mysql do
|
||||
desc 'Build the MySQL test databases'
|
||||
task :build_databases do
|
||||
%x( mysql --user=#{MYSQL_DB_USER} -e "create DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
%x( mysql --user=#{MYSQL_DB_USER} -e "create DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
config = ARTest.config['connections']['mysql']
|
||||
%x( mysql --user=#{config['arunit']['username']} -e "create DATABASE #{config['arunit']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
%x( mysql --user=#{config['arunit2']['username']} -e "create DATABASE #{config['arunit2']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
end
|
||||
|
||||
desc 'Drop the MySQL test databases'
|
||||
task :drop_databases do
|
||||
%x( mysqladmin --user=#{MYSQL_DB_USER} -f drop activerecord_unittest )
|
||||
%x( mysqladmin --user=#{MYSQL_DB_USER} -f drop activerecord_unittest2 )
|
||||
config = ARTest.config['connections']['mysql']
|
||||
%x( mysqladmin --user=#{config['arunit']['username']} -f drop #{config['arunit']['database']} )
|
||||
%x( mysqladmin --user=#{config['arunit2']['username']} -f drop #{config['arunit2']['database']} )
|
||||
end
|
||||
|
||||
desc 'Rebuild the MySQL test databases'
|
||||
|
@ -104,14 +105,16 @@ task :rebuild_mysql_databases => 'mysql:rebuild_databases'
|
|||
namespace :postgresql do
|
||||
desc 'Build the PostgreSQL test databases'
|
||||
task :build_databases do
|
||||
%x( createdb -E UTF8 activerecord_unittest )
|
||||
%x( createdb -E UTF8 activerecord_unittest2 )
|
||||
config = ARTest.config['connections']['postgresql']
|
||||
%x( createdb -E UTF8 #{config['arunit']['database']} )
|
||||
%x( createdb -E UTF8 #{config['arunit2']['database']} )
|
||||
end
|
||||
|
||||
desc 'Drop the PostgreSQL test databases'
|
||||
task :drop_databases do
|
||||
%x( dropdb activerecord_unittest )
|
||||
%x( dropdb activerecord_unittest2 )
|
||||
config = ARTest.config['connections']['postgresql']
|
||||
%x( dropdb #{config['arunit']['database']} )
|
||||
%x( dropdb #{config['arunit2']['database']} )
|
||||
end
|
||||
|
||||
desc 'Rebuild the PostgreSQL test databases'
|
||||
|
@ -150,8 +153,9 @@ namespace :frontbase do
|
|||
DISCONNECT ALL;
|
||||
)
|
||||
end
|
||||
create_activerecord_unittest = build_frontbase_database['activerecord_unittest', File.join(SCHEMA_ROOT, 'frontbase.sql')]
|
||||
create_activerecord_unittest2 = build_frontbase_database['activerecord_unittest2', File.join(SCHEMA_ROOT, 'frontbase2.sql')]
|
||||
config = ARTest.config['connections']['frontbase']
|
||||
create_activerecord_unittest = build_frontbase_database[config['arunit']['database'], File.join(SCHEMA_ROOT, 'frontbase.sql')]
|
||||
create_activerecord_unittest2 = build_frontbase_database[config['arunit2']['database'], File.join(SCHEMA_ROOT, 'frontbase2.sql')]
|
||||
execute_frontbase_sql = Proc.new do |sql|
|
||||
system(<<-SHELL)
|
||||
/Library/FrontBase/bin/sql92 <<-SQL
|
||||
|
|
Loading…
Reference in New Issue