lib/shelly/cli/backup.rb in shelly-0.2.25 vs lib/shelly/cli/backup.rb in shelly-0.2.26
- old
+ new
@@ -101,32 +101,32 @@
desc "import KIND FILENAME", "Import database from dump file"
long_desc %{
Import database from local dump file to your cloud
KIND - Database kind. Possible values are: postgresql or mongodb
- FILENAME - Database dump file or directory (mongodb), it has to be in current working directory.
+ FILENAME - Database dump file or directory (mongodb)
}
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
say "You are about import #{kind} database for cloud #{app} to state from file #{filename}"
ask_to_import_database
archive = compress(filename)
say "Uploading #{archive}", :green
- app.upload(archive)
+ connection = app.upload(archive)
say "Uploading done", :green
say "Importing database", :green
- app.import_database(kind, archive)
+ app.import_database(kind, archive, connection["server"])
say "Database imported successfully", :green
end
no_tasks do
def compress(filename)
- archive_name = "#{::File.basename(filename)}.tar"
+ archive_name = "#{::File.basename(filename)}-#{Time.now.to_i}.tar.bz2"
say "Compressing #{filename} into #{archive_name}", :green
- system("tar -cf #{archive_name} #{filename}")
+ system("tar -cjf #{archive_name} #{filename}")
archive_name
end
end
end
end