lib/shelly/cli/backup.rb in shelly-0.1.24 vs lib/shelly/cli/backup.rb in shelly-0.1.25
- old
+ new
@@ -1,8 +1,9 @@
require "shelly/cli/command"
require "shelly/backup"
require "shelly/download_progress_bar"
+require 'launchy'
module Shelly
module CLI
class Backup < Command
namespace :backup
@@ -17,18 +18,18 @@
desc "list", "List available database backups"
def list
app = multiple_clouds(options[:cloud], "backup list")
backups = app.database_backups
if backups.present?
- limit = -1
+ limit = 0
unless options[:all] || backups.count < (Shelly::Backup::LIMIT + 1)
limit = Shelly::Backup::LIMIT - 1
say "Limiting the number of backups to #{Shelly::Backup::LIMIT}."
say "Use --all or -a option to list all backups."
end
to_display = [["Filename", "| Size", "| State"]]
- backups[0..limit].each do |backup|
+ backups[-limit..-1].each do |backup|
to_display << [backup.filename, "| #{backup.human_size}", "| #{backup.state.humanize}"]
end
say "Available backups:", :green
say_new_line
@@ -68,10 +69,10 @@
cloudfile = Cloudfile.new
unless kind || cloudfile.present?
say_error "Cloudfile must be present in current working directory or specify database kind with:", :with_exit => false
say_error "`shelly backup create DB_KIND`"
end
- app.request_backup(kind || cloudfile.backup_databases(app))
+ app.request_backup(kind || app.backup_databases)
say "Backup requested. It can take up to several minutes for " +
"the backup process to finish.", :green
rescue Client::ValidationException => e
e.each_error { |error| say_error error, :with_exit => false }
exit 1