Class: Kaboom::Backup
- Inherits:
-
Thor
- Object
- Thor
- Kaboom::Backup
- Defined in:
- lib/kaboom/backup.rb
Constant Summary
Constants included from Config
Instance Method Summary collapse
Methods included from Config
#database_config, #load_credentials, #load_env, #validate_repository!
Methods included from Utils
#confirm_proceed, #confirm_production_action, #say_and_exit, #validate_destination
Instance Method Details
#apply ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kaboom/backup.rb', line 21 def apply backup_file = [:file] unless File.exist?(backup_file) say_and_exit "Error: Backup file #{backup_file} not found", :red end confirm_proceed("Do you want to apply the backup to your local database? THIS WILL REMOVE YOUR EXISTING LOCAL DATABASE") local_db_config = database_config('development') if DatabaseHelper.apply_backup(local_db_config, backup_file) say "Backup applied successfully to local database!", :green else say_and_exit \ "Error: Backup restore failed. Is there an open connection to the local database? Stop the Rails application and try again.", :red end end |
#pull(destination = 'staging') ⇒ Object
12 13 14 15 16 17 |
# File 'lib/kaboom/backup.rb', line 12 def pull(destination = 'staging') database_pull(destination) puts "\n" assets_pull(destination) say "Completed!", :green end |