class PXCBackup::RemoteRepo
Public Class Methods
new(path, options = {})
click to toggle source
Calls superclass method
# File lib/pxcbackup/remote_repo.rb, line 9 def initialize(path, options = {}) super(path, options) @which.s3cmd end
Public Instance Methods
backups()
click to toggle source
# File lib/pxcbackup/remote_repo.rb, line 14 def backups backups = [] output = Command.run("#{@which.s3cmd.shellescape} ls #{@path.shellescape}") output[:stdout].lines.to_a.each do |line| path = line.chomp.split[3] next unless Backup.regexp.match(path) backups << Backup.new(self, path) end backups.sort end
delete(backup)
click to toggle source
# File lib/pxcbackup/remote_repo.rb, line 31 def delete(backup) verify(backup) Command.run("#{@which.s3cmd.shellescape} del #{backup.path.shellescape}") end
stream_command(backup)
click to toggle source
# File lib/pxcbackup/remote_repo.rb, line 36 def stream_command(backup) verify(backup) "#{@which.s3cmd.shellescape} get --no-progress #{backup.path.shellescape} -" end
sync(local_repo)
click to toggle source
# File lib/pxcbackup/remote_repo.rb, line 25 def sync(local_repo) source = File.join(local_repo.path, '/') target = File.join(path, '/') Command.run("#{@which.s3cmd.shellescape} sync --no-progress --delete-removed #{source.shellescape} #{target.shellescape}") end