Sha256: e40a8906490544154e8d55c592481646f5056cca141f43e8e546bd63e886d90a

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 Bytes

Contents

module ActiveRecord::MysqlBackup
  def purge
    config = instance_variable_get("@config").slop

    recreate_database(config.database)  
  end
  
  def sqldump(file)
    config = instance_variable_get("@config").slop
    
    cmd_opts = ""
    cmd_opts << "-h #{config.host} " if config.host?
    cmd_opts << "-u #{config.username} " if config.username?
    cmd_opts += "-p#{config.password} " if config.password?

    cmd = "mysqldump #{cmd_opts} #{config.database} > #{file}"
    STDERR.puts cmd
    `#{cmd}`
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vex-0.6.2 lib/vex/active_record/mysql_backup.rb
vex-0.4.4 lib/vex/active_record/mysql_backup.rb
vex-0.4.2 lib/vex/active_record/mysql_backup.rb