Sha256: 169e5014e2363bbe9dfe79d40e922358973d87d4506b4f1dd8339372cea5f503

Contents?: true

Size: 856 Bytes

Versions: 12

Compression:

Stored size: 856 Bytes

Contents

namespace :mail_engine do
  desc "Check mail schedule table and send the scheduled mail."
  task :export_mail_engine_database => :environment do
    datetime = Time.now.strftime("%Y%m%d")

    db_config = YAML.load_file(File.join(Rails.root, 'config', 'database.yml'))[Rails.env]
    db_username = db_config["username"]
    db_password = db_config["password"]
    db_database = db_config["database"]
    db_socket   = db_config["socket"]
    tables = ['mail_templates', 'mail_schedules', "mail_template_files", "template_partials"]
    backup_file_path = File.join(Rails.root,"tmp", "mail_engine_backup", "#{db_database}_#{datetime}.sql")

    system "mkdir -p #{File.join(Rails.root,"tmp", "mail_engine_backup")}"
    system "mysqldump -u #{db_username} -S #{db_socket} -p'#{db_password}' #{db_database} #{tables.join(' ')}> #{backup_file_path}"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mail_engine-0.1.15 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.14 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.13 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.12 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.11 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.10 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.9 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.8 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.7 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.6 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.5 lib/mail_engine/tasks/export_mail_engine_database.rake
mail_engine-0.1.4 lib/mail_engine/tasks/export_mail_engine_database.rake