Sha256: 080b37a7baa62ef48347226d967da72f6800589b2d6dbae89c93708b8545e860
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
require "bundler/setup" require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new task :default => [:spec] namespace :db do task :prepare do require File.expand_path("spec/dummy/config/application", File.dirname(__FILE__)) Dummy::Application.load_tasks orig_env = ENV["RAILS_ENV"] begin Rails.env = "test_db_migration" Rake::Task["db:create"].invoke Rake::Task["db:schema:load"].invoke ensure ENV["RAILS_ENV"] = orig_env end file = File.expand_path('spec/dummy/config/database.yml', File.dirname(__FILE__)) config = YAML.load_file(file) case config["test"]["adapter"] when "mysql2" 3.times do |i| system("mysql -u root -e 'drop database replidog_test_slave#{i + 1}' > /dev/null 2> /dev/null") system("mysql -u root -e 'create database replidog_test_slave#{i + 1}'") system("mysqldump -u root replidog_test | mysql -u root replidog_test_slave#{i + 1}") end system("mysql -u root -e 'drop database replidog_test_user' > /dev/null 2> /dev/null") system("mysql -u root -e 'drop database replidog_test_user_slave' > /dev/null 2> /dev/null") system("mysql -u root -e 'create database replidog_test_user'") system("mysql -u root -e 'create database replidog_test_user_slave'") system("mysqldump -u root replidog_test | mysql -u root replidog_test_user") system("mysqldump -u root replidog_test | mysql -u root replidog_test_user_slave") when "sqlite" 3.times do |i| FileUtils.copy("#{Rails.root}/db/test.sqlite3", "#{Rails.root}/db/test_slave#{i + 1}.sqlite3") end FileUtils.copy("#{Rails.root}/db/test.sqlite3", "#{Rails.root}/db/test_user.sqlite3") FileUtils.copy("#{Rails.root}/db/test.sqlite3", "#{Rails.root}/db/test_user_slave.sqlite3") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
replidog-1.1.3 | Rakefile |
replidog-1.1.2 | Rakefile |
replidog-1.1.1 | Rakefile |