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, #bridge, #command_env, #confirm!, #deploy_snippet, #deployment_mode?, #direct_app, #exec_remote, #init_config_root, #local_app, #local_command_config, #local_preferences, #prompt_required, #redactor, #shared_config_path, #shared_config_template, #write_init_file

Class Method Details

.basenameObject



154
155
156
# File 'lib/kamal_backup/cli.rb', line 154

def self.basename
  CLI.basename
end

Instance Method Details

#local(snapshot = "latest") ⇒ Object



159
160
161
162
# File 'lib/kamal_backup/cli.rb', line 159

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



165
166
167
168
169
170
171
172
173
# File 'lib/kamal_backup/cli.rb', line 165

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