Class: Backups::Restore
- Inherits:
-
Object
- Object
- Backups::Restore
- Defined in:
- lib/backups/restore.rb
Instance Method Summary collapse
-
#initialize(name) ⇒ Restore
constructor
A new instance of Restore.
- #run ⇒ Object
Constructor Details
#initialize(name) ⇒ Restore
Returns a new instance of Restore.
5 6 7 |
# File 'lib/backups/restore.rb', line 5 def initialize(name) @name = name end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/backups/restore.rb', line 9 def run raise StandardError, "No backups found" if backups["files"].blank? raise StandardError, "File not found" unless service.exist?(key) download decompress File.delete(path) if File.exist?(path) FileUtils.mv(download_path, path) File.delete("#{download_path}.gz") if File.exist?("#{download_path}.gz") File.delete(download_path) if File.exist?(download_path) puts "Restore complete!" end |