class TinyBackup::Config

Attributes

backup_folder[RW]

The folder name that is used to keep the backup files and temporary files. @return [String] defaults to “db/backup”

date_format[RW]

The date format that will be appended and used to time-stamp the backup files. Can be any valid date format similar with the ISO C and POSIX directives. @return [String] defaults to “%d-%m-%Y_%H:%M”

max_versions[RW]

Maximum number of versions that can exist. If this number is exceeded, the first .diff version is merged in the starting .zip file and cannot be reversed. @return [Integer] defaults to 32 (if backup is done daily, keep the last month versions)

per_page[RW]

Maximum number of rows fetched by a single query to avoid memory crashes. If your table has more rows it will be used multiple query to fetch all the data. @return [Integer] defaults to 100000

silent[RW]

true if the debug info will be provided in the process. @return [Boolean] defaults to false

version_prefix[RW]

The prefix used to name each .diff file that contains changes from the last version. Automatically generated version_number will be appended to the version_prefix. @return [String] defaults to “ver_”

zip_prefix[RW]

The prefix used to name the starting .zip file that contains a schema.rb file and a .csv file for each non-empty table. @return [String] defaults to “origin”

Public Class Methods

new() click to toggle source
# File lib/configure.rb, line 41
def initialize
  @backup_folder  = "db/backup"
  @date_format    = "%d-%m-%Y_%H:%M"
  @version_prefix = "ver_"
  @zip_prefix     = "origin"
  @max_versions   = 32
  @per_page       = 100000
  @silent         = false
end

Public Instance Methods

backup_folder=(val) click to toggle source
# File lib/configure.rb, line 51
def backup_folder= val
  @backup_folder = val.to_s[0..-2] if val.to_s.last == "/"
end
date_format=(val) click to toggle source
# File lib/configure.rb, line 64
def date_format= val
  begin
    Time.now.strftime(val).to_datetime
  rescue
    raise ArgumentError, "invalid date format"
  end

  @date_format = val
end