class RdiffBackupWrapper::Backup
Attributes
config[R]
Public Class Methods
new(config)
click to toggle source
# File lib/rdiff_backup_wrapper/backup.rb, line 7 def initialize(config) @config = config end
Public Instance Methods
cmd()
click to toggle source
# File lib/rdiff_backup_wrapper/backup.rb, line 43 def cmd ['rdiff-backup', source, destination] end
destination()
click to toggle source
# File lib/rdiff_backup_wrapper/backup.rb, line 15 def destination ensure_slash_end('destination') end
ensure_slash_end(key)
click to toggle source
# File lib/rdiff_backup_wrapper/backup.rb, line 19 def ensure_slash_end(key) if config[key].end_with? '/' return config[key] end config[key] + '/' end
run()
click to toggle source
# File lib/rdiff_backup_wrapper/backup.rb, line 26 def run output = {} command = [ 'nice', 'ionice', '-c', '3', ] + cmd Open3.popen3(*command) do |i,o,e,t| output[:name] = config['name'] output[:stdout] = o.read output[:stderr] = e.read output[:retval] = t.value end output end
source()
click to toggle source
# File lib/rdiff_backup_wrapper/backup.rb, line 11 def source ensure_slash_end('source') end
to_s()
click to toggle source
# File lib/rdiff_backup_wrapper/backup.rb, line 47 def to_s "<Backup name=#{config['name']}>" end