Module: ActiveRecord::MysqlBackup

Defined in:
lib/vex/active_record/mysql_backup.rb

Instance Method Summary collapse

Instance Method Details

#purgeObject



2
3
4
5
6
# File 'lib/vex/active_record/mysql_backup.rb', line 2

def purge
  config = instance_variable_get("@config").slop

  recreate_database(config.database)  
end

#sqldump(file) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vex/active_record/mysql_backup.rb', line 8

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