Class: Flydata::Parser::Mysql::MysqlDumpGeneratorMasterData
Instance Method Summary
collapse
#initialize
Instance Method Details
#dump(file_path) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 57
def dump(file_path)
cmd = "#{@dump_cmd} -r #{file_path}"
o, e, s = Open3.capture3(cmd)
e.to_s.each_line {|l| puts l unless /^Warning:/ =~ l } unless e.to_s.empty?
unless s.exitstatus == 0
if File.exists?(file_path)
File.open(file_path, 'r') {|f| f.each_line{|l| puts l}}
FileUtils.rm(file_path)
end
raise "Failed to run mysqldump command."
end
unless File.exists?(file_path)
raise "mysqldump file does not exist. Something wrong..."
end
if File.size(file_path) == 0
raise "mysqldump file is empty. Something wrong..."
end
true
end
|
#generate_dump_cmd(conf) ⇒ Object