Class: WpBackup::CLI
- Inherits:
-
Thor
- Object
- Thor
- WpBackup::CLI
- Defined in:
- lib/wp_backup/cli.rb
Instance Method Summary collapse
- #backup ⇒ Object
- #cleanup ⇒ Object
- #create_config(file) ⇒ Object
- #list ⇒ Object
- #restore(key) ⇒ Object
Instance Method Details
#backup ⇒ Object
9 10 11 12 13 |
# File 'lib/wp_backup/cli.rb', line 9 def backup config = Config.new([:config_file]) key = Backup.new(config).create(![:site_only], ![:db_only]) puts "Backed up to #{key}" end |
#cleanup ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/wp_backup/cli.rb', line 28 def cleanup config = Config.new([:config_file]) keep = [:keep] = {} config.s3.keys.each { |k| [Time.parse(k, "%Y%m%d%H%M%S")] = k } remove = .keys.sort.reverse.slice(keep.to_i, .length) .keep_if { |k,v| remove.include?(k) } config.s3.delete_keys(.values) end |
#create_config(file) ⇒ Object
46 47 48 |
# File 'lib/wp_backup/cli.rb', line 46 def create_config(file) Config.write_sample(file) end |