Class: Marz::Rsync::Command
- Inherits:
-
Object
- Object
- Marz::Rsync::Command
- Defined in:
- lib/marz/rsync/command.rb
Overview
The rsync command to be run
Class Method Summary collapse
- .command ⇒ Object
- .command=(cmd) ⇒ Object
-
.run(*opts) ⇒ ExitCode
Runs an rsync job, returns the exit code, and does logging.
Class Method Details
.command ⇒ Object
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
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 |