lib/shelly/cli/backup.rb in shelly-0.4.39 vs lib/shelly/cli/backup.rb in shelly-0.4.40
- old
+ new
@@ -68,11 +68,12 @@
map "new" => :create
def create(kind = nil)
app = multiple_clouds(options[:cloud], "backup create [DB_KIND]")
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 "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 || app.backup_databases)
say "Backup requested. It can take up to several minutes for " +
"the backup process to finish.", :green
@@ -85,11 +86,12 @@
desc "restore FILENAME", "Restore database to state from given backup"
def restore(filename)
app = multiple_clouds(options[:cloud], "backup restore FILENAME")
backup = app.database_backup(filename)
- say "You are about to restore #{backup.kind} database for cloud #{backup.code_name} to state from #{backup.filename}"
+ say "You are about to restore #{backup.kind} database for cloud" \
+ " #{backup.code_name} to state from #{backup.filename}"
say_new_line
ask_to_restore_database
app.restore_backup(filename)
say_new_line
say "Restore has been scheduled. Wait a few minutes till database is restored.", :green
@@ -112,20 +114,22 @@
def import(kind, filename)
app = multiple_clouds(options[:cloud], "backup import KIND FILENAME")
unless ::File.exist?(filename)
say_error "File #{filename} doesn't exist"
end
- unless ['postgresql', 'mongodb'].include?(kind)
- say_error "Kind is invalid. You can import backup of: postgresql, mongodb"
+ unless ['postgresql', 'mysql', 'mongodb'].include?(kind)
+ say_error "Kind is invalid. You can import backup of: postgresql, " \
+ "mysql, mongodb"
end
if options[:reset]
say_warning "You are about to reset database #{kind} for cloud #{app}"
say_warning "Next, database will be restored to state from file #{filename}"
question = "I want to reset and import the database from dump (yes/no):"
say_new_line
yes?(question) ? app.reset_database(kind) : say_error("Canceled")
else
- say_warning "You are about to import #{kind} database for cloud #{app} to state from file #{filename}"
+ say_warning "You are about to import #{kind} database for cloud " \
+ "#{app} to state from file #{filename}"
question = "I want to import the database from dump (yes/no):"
say_new_line
say_error "Canceled" unless yes?(question)
end
archive = compress(filename)