Class: Marz::Rsync::Command

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

Overview

The rsync command to be run

Class Method Summary collapse

Class Method Details

.commandObject



18
19
20
# File 'lib/marz/rsync/command.rb', line 18

def self.command
  @command ||= "rsync"
end

.command=(cmd) ⇒ Object



22
23
24
# File 'lib/marz/rsync/command.rb', line 22

def self.command=(cmd)
  @command = cmd
end

.run(*opts) ⇒ ExitCode

Runs an rsync job, returns the exit code, and does logging

Parameters:

  • opts (Array)

Returns:

  • (ExitCode)


12
13
14
15
16
# File 'lib/marz/rsync/command.rb', line 12

def self.run(*opts)
  cmd = ['rsync', '--itemize-changes', '--stats', '-h', opts].flatten.shelljoin
  output = `#{cmd} 2>&1`
  Result.new(output, $?.exitstatus)
end