Class: Rsync::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/rsync/command.rb

Overview

An rsync command to be run

Class Method Summary collapse

Class Method Details

.run(*args) ⇒ Result

Runs the rsync job and returns the results

Parameters:

  • args (Array)

Returns:



8
9
10
11
# File 'lib/rsync/command.rb', line 8

def self.run(*args)
  output = run_command("rsync --itemize-changes #{args.join(" ")}")
  Result.new(output, $?.exitstatus)
end

.run_command(cmd, &block) ⇒ Object



15
16
17
18
19
20
21
# 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