Class: FilesBackup

Inherits:
Backup show all
Defined in:
lib/backup/files_backup.rb

Constant Summary

Constants inherited from Backup

Backup::DATE_FORMAT

Instance Attribute Summary collapse

Attributes inherited from Backup

#dry_run, #quiet

Instance Method Summary collapse

Methods inherited from Backup

#backup_type, #clean_files, #compress?, #debug?, #encrypt?, #encrypt_compress_pipe_command, #ensure_path, #filename, #filename_extension, #filepath, #get_datetime_from_filename, #human_filesize, #mark_file_to_delete, #minimum_backup_size, #output_command, #process_clean_files, #run, #show_statistics, #verify_backup

Constructor Details

#initialize(files_backup = '/etc', compress = true, encrypt = nil) ⇒ FilesBackup

Returns a new instance of FilesBackup.



6
7
8
9
# File 'lib/backup/files_backup.rb', line 6

def initialize files_backup = '/etc', compress = true, encrypt = nil
  @files_backup = files_backup
  super compress: compress, encrypt: encrypt
end

Instance Attribute Details

#files_backupObject (readonly)

Returns the value of attribute files_backup.



4
5
6
# File 'lib/backup/files_backup.rb', line 4

def files_backup
  @files_backup
end

Instance Method Details

#backup_commandObject



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

def backup_command
  "tar -c #{files_backup}"
end

#backup_type_filenameObject



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

def backup_type_filename
  files_backup.sub(/^\//, '').gsub('/', '_')
end

#pathObject



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

def path
  "#{Techinform::BACKUPS_LOCAL_PREFIX}/#{backup_type}/#{backup_type_filename}"
end


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

def print_info
  puts "Run #{files_backup} backup to #{filepath}..."
end