Permalink
Browse files

use config for username in rake tasks

  • Loading branch information...
1 parent 6ce284e commit 70834cfc99d2673e73fb82d2efcd501ce435b1a0 @bradrobertson bradrobertson committed Nov 9, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 Rakefile
View
@@ -44,15 +44,15 @@ namespace :postgres do
desc 'Build the PostgreSQL test databases'
task :build_db do
- %x{ createdb -E UTF8 #{pg_config['database']} -Upostgres } rescue "test db already exists"
+ %x{ createdb -E UTF8 #{pg_config['database']} -U#{pg_config['username']} } rescue "test db already exists"
ActiveRecord::Base.establish_connection pg_config
ActiveRecord::Migrator.migrate('spec/dummy/db/migrate')
end
desc "drop the PostgreSQL test database"
task :drop_db do
puts "dropping database #{pg_config['database']}"
- %x{ dropdb #{pg_config['database']} -Upostgres }
+ %x{ dropdb #{pg_config['database']} -U#{pg_config['username']} }
end
end
@@ -63,15 +63,15 @@ namespace :mysql do
desc 'Build the MySQL test databases'
task :build_db do
- %x{ mysqladmin -u root create #{my_config['database']} } rescue "test db already exists"
+ %x{ mysqladmin -u #{my_config['username']} create #{my_config['database']} } rescue "test db already exists"
ActiveRecord::Base.establish_connection my_config
ActiveRecord::Migrator.migrate('spec/dummy/db/migrate')
end
desc "drop the MySQL test database"
task :drop_db do
puts "dropping database #{my_config['database']}"
- %x{ mysqladmin -u root drop #{my_config['database']} --force}
+ %x{ mysqladmin -u #{my_config['username']} drop #{my_config['database']} --force}
end
end

0 comments on commit 70834cf

Please sign in to comment.