Class: Synkronos::Rsync
- Inherits:
-
Object
- Object
- Synkronos::Rsync
- Defined in:
- lib/synkronos/rsync/rsync.rb
Overview
Generates and executes rsync command. If something is going bad exits with a message to stderr.
Class Method Summary collapse
Class Method Details
.sync(src, dest, ssh = false, port = 22) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/synkronos/rsync/rsync.rb', line 10 def self.sync(src, dest, ssh = false, port = 22) src += '/' unless src.end_with?('/') cmd = "rsync -a --delete #{ssh ? "-e 'ssh -p #{port}'" : nil} #{src} #{dest}" Open3.popen3(cmd) do |_, _, stderr, wait_thr| abort(stderr.read) unless wait_thr.value.success? end end |