Method: Backup::Database::SQLite#perform!

Defined in:
lib/backup/database/sqlite.rb

#perform!Object

Performs the sqlitedump command and outputs the data to the specified path based on the ‘trigger’



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/backup/database/sqlite.rb', line 28

def perform!
  super

  dump = "echo '.dump' | #{ sqlitedump_utility } #{ path }"

  pipeline = Pipeline.new
  dump_ext = 'sql'

  pipeline << dump
  if model.compressor
    model.compressor.compress_with do |command, ext|
      pipeline << command
      dump_ext << ext
    end
  end

  pipeline << "cat > '#{ File.join( dump_path , dump_filename) }.#{ dump_ext }'"

  pipeline.run

  if pipeline.success?
    log!(:finished)
  else
    raise Error,
      "#{ database_name } Dump Failed!\n" + pipeline.error_messages
  end
end