Class: Wordmove::Actions::Ftp::BackupRemoteDb
- Inherits:
-
Object
- Object
- Wordmove::Actions::Ftp::BackupRemoteDb
- Extended by:
- LightService::Action
- Includes:
- Helpers
- Defined in:
- lib/wordmove/actions/ftp/backup_remote_db.rb
Overview
Bakups an already downloaded remote DB dump
Class Method Summary collapse
-
.execute ⇒ LightService::Context
Action’s context.
Class Method Details
.execute ⇒ LightService::Context
Returns Action’s context.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/wordmove/actions/ftp/backup_remote_db.rb', line 23 executed do |context| context.logger.task 'Backup remote DB' if simulate?(cli_options: context.) context.logger.info 'A backup of the remote DB would have been saved into ' \ "#{context.db_paths.backup.remote.gzipped_path}, " \ 'but you\'re simulating' next context end begin result = Wordmove::Actions::RunLocalCommand.execute( logger: context.logger, cli_options: context., command: compress_command(file_path: context.db_paths.local.path) ) raise(result.) if result.failure? FileUtils.mv( context.db_paths.local.gzipped_path, context.db_paths.backup.remote.gzipped_path ) context.logger.success("Backup saved at #{context.db_paths.backup.remote.gzipped_path}") rescue Errno::ENOENT, RuntimeError => e context.fail_and_return!("Remote DB backup failed with: <#{e.}>. Aborting.") end end |