Class: TinyBackup::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/configure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



41
42
43
44
45
46
47
48
49
# 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

Instance Attribute Details

#backup_folderString

The folder name that is used to keep the backup files and temporary files.

Returns:

  • (String)

    defaults to “db/backup”



15
16
17
# File 'lib/configure.rb', line 15

def backup_folder
  @backup_folder
end

#date_formatString

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.

Returns:

  • (String)

    defaults to “%d-%m-%Y_%H:%M”



19
20
21
# File 'lib/configure.rb', line 19

def date_format
  @date_format
end

#max_versionsInteger

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.

Returns:

  • (Integer)

    defaults to 32 (if backup is done daily, keep the last month versions)



31
32
33
# File 'lib/configure.rb', line 31

def max_versions
  @max_versions
end

#per_pageInteger

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.

Returns:

  • (Integer)

    defaults to 100000



35
36
37
# File 'lib/configure.rb', line 35

def per_page
  @per_page
end

#silentBoolean

true if the debug info will be provided in the process.

Returns:

  • (Boolean)

    defaults to false



39
40
41
# File 'lib/configure.rb', line 39

def silent
  @silent
end

#version_prefixString

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.

Returns:

  • (String)

    defaults to “ver_”



23
24
25
# File 'lib/configure.rb', line 23

def version_prefix
  @version_prefix
end

#zip_prefixString

The prefix used to name the starting .zip file that contains a schema.rb file and a .csv file for each non-empty table.

Returns:

  • (String)

    defaults to “origin”



27
28
29
# File 'lib/configure.rb', line 27

def zip_prefix
  @zip_prefix
end