Class: Syncr::Rsync

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

Overview

Class to handle making calls to rsync executable

Direct Known Subclasses

Listener

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rsync(from, target_options) ⇒ Object

Calls system rsync with options Can be called using DSL syntax `rsync '/some/path', to: '/another/path'` or just `rsync '/some/path', '/another/path'`


9
10
11
12
13
14
15
16
# File 'lib/syncr/rsync.rb', line 9

def self.rsync(from, target_options)
  # Check if rsync is installed and return that path
  system_rsync_path = `which rsync`.strip
  raise RsyncNotInstalledError unless $?.exitstatus == 0

  to = target_options.is_a?(Hash) ? target_options[:to] : target_options
  system("#{system_rsync_path} -avzh #{from} #{to}")
end

Instance Method Details

#rsync(*args) ⇒ Object Also known as: call

Forwards to Syncr::Rsync::rsync. See Syncr::Rsync::rsync


19
20
21
# File 'lib/syncr/rsync.rb', line 19

def rsync(*args)
  self.class.rsync(*args)
end