Class: Decidim::Voca::AppBackup
- Inherits:
-
Object
- Object
- Decidim::Voca::AppBackup
- Defined in:
- lib/decidim/voca/backup/app_backup.rb
Instance Method Summary collapse
-
#initialize ⇒ AppBackup
constructor
A new instance of AppBackup.
-
#run! ⇒ String
Run a backup of : public/uploads current database And store it in a .tar.gz file.
Constructor Details
#initialize ⇒ AppBackup
Returns a new instance of AppBackup.
6 7 8 |
# File 'lib/decidim/voca/backup/app_backup.rb', line 6 def initialize logger.info "⚙️ starts backup (##{now})" end |
Instance Method Details
#run! ⇒ String
Run a backup of :
public/uploads
current database
And store it in a .tar.gz file.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/decidim/voca/backup/app_backup.rb', line 16 def run! Dir.mktmpdir do |dir| logger.debug "Prepare backup in tmp dir '#{dir}'" dump_database(dir) compress_source_path(uploads_path, dir) compress_source_path(logs_path, dir) (dir) with_backup_dir do |backup_dir| backup_file = "#{backup_dir}/#{now}-backup.tar.gz" compress_tar!("#{dir}/", backup_file) backup_file end end end |