Class: Backuper
- Inherits:
-
Object
- Object
- Backuper
- Defined in:
- lib/backuper.rb
Constant Summary collapse
- TMP_DIR =
"/tmp/backuper"
Instance Attribute Summary collapse
-
#ftp_params ⇒ Object
writeonly
Sets the attribute ftp_params.
-
#mysql_params ⇒ Object
writeonly
Sets the attribute mysql_params.
-
#ssh_params ⇒ Object
writeonly
Sets the attribute ssh_params.
Instance Method Summary collapse
- #config_dir(path) ⇒ Object
- #config_file(path) ⇒ Object
- #data_dir(path) ⇒ Object
-
#initialize ⇒ Backuper
constructor
A new instance of Backuper.
- #mysql_database(name) ⇒ Object
- #perform! ⇒ Object
- #sqlite_database(path) ⇒ Object
Constructor Details
#initialize ⇒ Backuper
Returns a new instance of Backuper.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/backuper.rb', line 9 def initialize @config_files = [] @config_dirs = [] @sqlite_databases = [] @mysql_params = {} @mysql_databases = [] @data_dirs = [] @ftp_params = {} @ssh_params = {} @archive_filename = "backup-#{Time.now.strftime('%Y-%m-%d')}-#{Time.now.to_i}.tar.gz" end |
Instance Attribute Details
#ftp_params=(value) ⇒ Object (writeonly)
Sets the attribute ftp_params
6 7 8 |
# File 'lib/backuper.rb', line 6 def ftp_params=(value) @ftp_params = value end |
#mysql_params=(value) ⇒ Object (writeonly)
Sets the attribute mysql_params
5 6 7 |
# File 'lib/backuper.rb', line 5 def mysql_params=(value) @mysql_params = value end |
#ssh_params=(value) ⇒ Object (writeonly)
Sets the attribute ssh_params
7 8 9 |
# File 'lib/backuper.rb', line 7 def ssh_params=(value) @ssh_params = value end |
Instance Method Details
#config_dir(path) ⇒ Object
25 26 27 |
# File 'lib/backuper.rb', line 25 def config_dir(path) @config_dirs << path end |
#config_file(path) ⇒ Object
21 22 23 |
# File 'lib/backuper.rb', line 21 def config_file(path) @config_files << path end |
#data_dir(path) ⇒ Object
37 38 39 |
# File 'lib/backuper.rb', line 37 def data_dir(path) @data_dirs << path end |
#mysql_database(name) ⇒ Object
33 34 35 |
# File 'lib/backuper.rb', line 33 def mysql_database(name) @mysql_databases << name end |
#perform! ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/backuper.rb', line 41 def perform! self.prepare self.backup_config_files_and_dirs self.backup_sqlite_databases self.backup_mysql_databases self.create_archive self.upload_archive self.cleanup end |
#sqlite_database(path) ⇒ Object
29 30 31 |
# File 'lib/backuper.rb', line 29 def sqlite_database(path) @sqlite_databases << path end |