class Backup::Syncer::RSync::Base
Attributes
additional_rsync_options[RW]
Additional String or Array of options for the rsync cli
Public Class Methods
new(syncer_id = nil, &block)
click to toggle source
Calls superclass method
Backup::Syncer::Base::new
# File lib/backup/syncer/rsync/base.rb, line 12 def initialize(syncer_id = nil, &block) super instance_eval(&block) if block_given? @path ||= '~/backups' end
Private Instance Methods
exclude_option()
click to toggle source
# File lib/backup/syncer/rsync/base.rb, line 32 def exclude_option excludes.map {|pattern| " --exclude='#{ pattern }'" }.join end
mirror_option()
click to toggle source
# File lib/backup/syncer/rsync/base.rb, line 28 def mirror_option mirror ? ' --delete' : '' end
paths_to_push()
click to toggle source
Each path is expanded, since these refer to local paths and are being shell-quoted. This will also remove any trailing ‘/` from each path, as we don’t want rsync’s “trailing / on source directories” behavior. This method is used by RSync::Local
and RSync::Push
.
# File lib/backup/syncer/rsync/base.rb, line 41 def paths_to_push directories.map {|dir| "'#{ File.expand_path(dir) }'" }.join(' ') end
rsync_command()
click to toggle source
Common base command for Local/Push/Pull
# File lib/backup/syncer/rsync/base.rb, line 23 def rsync_command utility(:rsync) << ' --archive' << mirror_option << exclude_option << " #{ Array(additional_rsync_options).join(' ') }".rstrip end