lib/shelly/cli/backup.rb in shelly-0.0.36 vs lib/shelly/cli/backup.rb in shelly-0.0.37
- old
+ new
@@ -11,11 +11,10 @@
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 "Must be run inside your project git repository" unless App.inside_git_repository?
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"]]
@@ -52,9 +51,26 @@
if e.not_found?
say_error "Backup not found", :with_exit => false
say "You can list available backups with 'shelly backup list' command"
else
raise e
+ end
+ end
+
+ 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
+ if e.unauthorized?
+ say_error "You have no access to '#{@app.code_name}' cloud defined in Cloudfile"
+ else
+ say_error e.message
end
end
end
end
end