Class: Backup::Database::Base

Inherits:
Object
  • Object
show all
Includes:
CLI, Configuration::Helpers
Defined in:
lib/backup/database/base.rb

Direct Known Subclasses

MongoDB, MySQL, PostgreSQL, Redis

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configuration::Helpers

#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods

Methods included from CLI

#mkdir, #rm, #run, #utility

Instance Attribute Details

#dump_pathObject

Contains the path to where the database should be dumped



11
12
13
# File 'lib/backup/database/base.rb', line 11

def dump_path
  @dump_path
end

#utility_pathObject

Allows the user to specify the path to a “dump” utility in case it cannot be auto-detected by Backup



16
17
18
# File 'lib/backup/database/base.rb', line 16

def utility_path
  @utility_path
end

Instance Method Details

#log!Object

Logs a message to the console and log file to inform the client that Backup is dumping the database



28
29
30
# File 'lib/backup/database/base.rb', line 28

def log!
  Logger.message("#{ self.class } started dumping and archiving \"#{ name }\".")
end

#prepare!Object

Defines the @dump_path and ensures it exists by creating it



20
21
22
23
# File 'lib/backup/database/base.rb', line 20

def prepare!
  @dump_path = File.join(TMP_PATH, TRIGGER, self.class.name.split('::').last)
  mkdir(dump_path)
end