Class: DbBackup
Direct Known Subclasses
Constant Summary
Constants inherited from Backup
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from Backup
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(user: nil, database: nil, password: nil, compress: true, host: nil, encrypt: nil) ⇒ DbBackup
constructor
A new instance of DbBackup.
- #path ⇒ Object
- #restore_path ⇒ Object
Methods inherited from Backup
#backup_command, #backup_type, #backup_type_filename, #clean_files, #compress?, #debug?, #encrypt?, #encrypt_compress_pipe_command, #ensure_path, #filename_extension, #filepath, #get_datetime_from_filename, #human_filesize, #mark_file_to_delete, #minimum_backup_size, #output_command, #print_info, #process_clean_files, #run, #show_statistics, #verify_backup
Constructor Details
#initialize(user: nil, database: nil, password: nil, compress: true, host: nil, encrypt: nil) ⇒ DbBackup
Returns a new instance of DbBackup.
6 7 8 9 10 11 12 |
# File 'lib/backup/db_backup.rb', line 6 def initialize user: nil, database: nil, password: nil, compress: true, host: nil, encrypt: nil super compress: compress, encrypt: encrypt user = ENV['DBUSER'] if user.nil? password = ENV['PASSWORD'] if password.nil? @password, @user, @database, @host = password, user, database, host ensure_path unless database.nil? end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
4 5 6 |
# File 'lib/backup/db_backup.rb', line 4 def database @database end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/backup/db_backup.rb', line 4 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/backup/db_backup.rb', line 4 def password @password end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'lib/backup/db_backup.rb', line 4 def user @user end |
Instance Method Details
#filename ⇒ Object
14 15 16 |
# File 'lib/backup/db_backup.rb', line 14 def filename "#{backup_type}-#{database}-#{DateTime.now.strftime(DATE_FORMAT)}.#{filename_extension('sql')}" end |
#path ⇒ Object
18 19 20 |
# File 'lib/backup/db_backup.rb', line 18 def path "#{Techinform::BACKUPS_LOCAL_PREFIX}/#{backup_type}/#{database}" end |
#restore_path ⇒ Object
22 23 24 |
# File 'lib/backup/db_backup.rb', line 22 def restore_path "#{Techinform::BACKUPS_ALL_PREFIX}/backups/#{backup_type}/#{database}" end |