lib/shelly/cli/backup.rb in shelly-0.0.37 vs lib/shelly/cli/backup.rb in shelly-0.0.38
- old
+ new
@@ -6,16 +6,17 @@
module CLI
class Backup < Command
namespace :backup
include Helpers
+ before_hook :logged_in?, :only => [:list, :get, :create]
+ before_hook :cloudfile_present?, :only => [:list]
+
desc "list", "List database backups"
method_option :cloud, :type => :string, :aliases => "-c",
:desc => "Specify which cloud to list backups for"
def list
- logged_in?
- say_error "No Cloudfile found" unless Cloudfile.present?
multiple_clouds(options[:cloud], "backup list", "Select cloud to view database backups for using:")
backups = @app.database_backups
if backups.present?
to_display = [["Filename", "| Size"]]
backups.each do |backup|
@@ -58,10 +59,9 @@
desc "create [KIND]", "Creates current snapshot of given database. Default: all databases."
method_option :cloud, :type => :string, :aliases => "-c",
:desc => "Specify which cloud to create database snapshot for"
def create(kind = nil)
- logged_in?
multiple_clouds(options[:cloud], "backup create", "Select cloud to create snapshot of database")
@app.request_backup(kind)
say "Backup requested. It can take up to several minutes for" +
"the backup process to finish and the backup to show up in backups list.", :green
rescue Client::APIError => e