Class: KamalBackup::CLI::RestoreCLI

Inherits:
CommandBase show all
Defined in:
lib/kamal_backup/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#accessory_name, #accessory_reboot_command, #bridge, #command_env, #confirm!, #default_deploy_config?, #deploy_snippet, #deployment_mode?, #direct_app, #ensure_remote_version_match!, #exec_remote, #init_config_root, #local_app, #local_command_config, #local_preferences, #print_remote_version_status, #prompt_required, #redactor, #remote_version, #shared_config_path, #shared_config_template, #version_remote_mode?, #write_init_file

Class Method Details

.basenameObject



194
195
196
# File 'lib/kamal_backup/cli.rb', line 194

def self.basename
  CLI.basename
end

Instance Method Details

#local(snapshot = "latest") ⇒ Object



199
200
201
202
# File 'lib/kamal_backup/cli.rb', line 199

def local(snapshot = "latest")
  confirm!("Restore #{snapshot} into the local database and local files? This will overwrite local data.")
  puts(JSON.pretty_generate(local_app.restore_to_local_machine(snapshot)))
end

#production(snapshot = "latest") ⇒ Object



205
206
207
208
209
210
211
212
213
# File 'lib/kamal_backup/cli.rb', line 205

def production(snapshot = "latest")
  confirm!("Restore #{snapshot} into the production database and production files? This will overwrite production data.")

  if deployment_mode?
    exec_remote(["kamal-backup", "restore", "production", snapshot, "--yes"])
  else
    puts(JSON.pretty_generate(direct_app.restore_to_production(snapshot)))
  end
end