Class: WpBackup::Site
- Inherits:
-
Object
- Object
- WpBackup::Site
- Defined in:
- lib/wp_backup/site.rb
Instance Method Summary collapse
- #dump_to(file) ⇒ Object
-
#initialize(root_dir, backup_paths) ⇒ Site
constructor
A new instance of Site.
- #restore_from(file) ⇒ Object
Constructor Details
#initialize(root_dir, backup_paths) ⇒ Site
Returns a new instance of Site.
4 5 6 7 |
# File 'lib/wp_backup/site.rb', line 4 def initialize(root_dir, backup_paths) @root_dir = root_dir @backup_paths = backup_paths || [] end |
Instance Method Details
#dump_to(file) ⇒ Object
9 10 11 12 |
# File 'lib/wp_backup/site.rb', line 9 def dump_to(file) result = `cd #{@root_dir} && tar -cf #{file} #{@backup_paths.any? ? @backup_paths.join(' ') : '.'}` raise("Copy of site failed (#{$?})") unless result end |
#restore_from(file) ⇒ Object
14 15 16 17 18 |
# File 'lib/wp_backup/site.rb', line 14 def restore_from(file) if File.exists?(file) `cd #{@root_dir} && tar -xf #{file}` end end |