class RsyncRunner

Attributes

chdir[RW]
dest[RW]
excludes[RW]
flags[RW]
host[RW]
includes[RW]
logger[RW]
source[RW]
ssh[RW]
user[RW]

Public Class Methods

new(rsync_command) click to toggle source
# File vendor/rsync_command/lib/rsync_command.rb, line 12
def initialize(rsync_command)
  @logger = nil
  @source = ""
  @dest   = ""
  @flags  = ""
  @includes = []
  @excludes = []
  @rsync_command = rsync_command
end

Public Instance Methods

exec() click to toggle source
# File vendor/rsync_command/lib/rsync_command.rb, line 33
def exec
  return unless valid?
  dest = {
    :user => self.user,
    :host => self.host,
    :path => self.dest
  }
  src = self.source
  @rsync_command.exec_rsync(src, dest, self.to_hash)
end
log(*args) click to toggle source
# File vendor/rsync_command/lib/rsync_command.rb, line 21
def log(*args)
  @logger.log(*args)
end
to_hash() click to toggle source
# File vendor/rsync_command/lib/rsync_command.rb, line 27
def to_hash
  fields = [:flags, :includes, :excludes, :logger, :ssh, :chdir]
  fields.inject({}){|hsh, i|
    hsh[i] = self.send(i); hsh
  }
end
valid?() click to toggle source
# File vendor/rsync_command/lib/rsync_command.rb, line 24
def valid?
  !@source.empty? || !@dest.empty?
end