Class: Rsync::Command
- Inherits:
-
Object
- Object
- Rsync::Command
- Defined in:
- lib/rsync/command.rb
Overview
An rsync command to be run
Class Method Summary collapse
-
.run(*args) ⇒ Result
Runs the rsync job and returns the results.
- .run_command(cmd, &block) ⇒ Object
Class Method Details
.run(*args) ⇒ Result
Runs the rsync job and returns the results
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 |