class Rsync::Command

An rsync command to be run

Public Class Methods

run(*args) click to toggle source

Runs the rsync job and returns the results

@param args {Array} @return {Result}

# File lib/rsync/command.rb, line 8
def self.run(*args)
  output = run_command("rsync --itemize-changes #{args.join(" ")}")
  Result.new(output, $?.exitstatus)
end

Private Class Methods

run_command(cmd, &block) click to toggle source
# File lib/rsync/command.rb, line 15
def self.run_command(cmd, &block)
  if block_given?
    IO.popen("#{cmd} 2>&1", &block)
  else
    `#{cmd} 2>&1`
  end
end