class Backup::Database::SQLite
Attributes
path[RW]
Path to the sqlite3 file
sqlitedump_utility[RW]
Path to sqlite utility (optional)
Public Class Methods
new(model, database_id = nil, &block)
click to toggle source
Creates a new instance of the SQLite
adapter object
Calls superclass method
Backup::Database::Base::new
# File lib/backup/database/sqlite.rb, line 16 def initialize(model, database_id = nil, &block) super instance_eval(&block) if block_given? @sqlitedump_utility ||= utility(:sqlitedump) end
Public Instance Methods
perform!()
click to toggle source
Performs the sqlitedump command and outputs the data to the specified path based on the ‘trigger’
Calls superclass method
Backup::Database::Base#perform!
# File lib/backup/database/sqlite.rb, line 26 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