Sha256: ed006e2c7c152e23c79943fccc2ee3bada1eb94a99b87c91873d871624d57c29
Contents?: true
Size: 811 Bytes
Versions: 11
Compression:
Stored size: 811 Bytes
Contents
require_relative 'task_helper' namespace :dad do namespace :db do desc "データベースをロードします。" task :load do dump_file = ENV['DUMP_FILE'] || ask('ダンプファイル', :required => true) config = YAML.load(ERB.new(File.read('config/database.yml'), 0, '-').result)[Rails.env] host = config['host'] || 'localhost' database = config['database'] user = config['username'] password = config['password'] if dump_file.end_with?('.gz') run "zcat #{dump_file} | mysql -u #{user} -p#{password} -h #{host} #{database}", :mask => [/-p[^ ]+/, '-pFILTERED'] else run "mysql -u #{user} -p#{password} -h #{host} #{database} < #{dump_file}", :mask => [/-p[^ ]+/, '-pFILTERED'] end end end end
Version data entries
11 entries across 11 versions & 1 rubygems