Sha256: 7fb4b3659f64c06e7ff0106efa8b0eb700554174c8893b9e49fc8756d60fca2e

Contents?: true

Size: 1006 Bytes

Versions: 8

Compression:

Stored size: 1006 Bytes

Contents

# encoding: utf-8

module Backup
  module Syncer
    module RSync
      class Base < Syncer::Base

        ##
        # Additional String or Array of options for the rsync cli
        attr_accessor :additional_rsync_options

        private

        ##
        # Common base command for Local/Push/Pull
        def rsync_command
          utility(:rsync) << ' --archive' << mirror_option <<
              " #{ Array(additional_rsync_options).join(' ') }".rstrip
        end

        def mirror_option
          mirror ? ' --delete' : ''
        end

        ##
        # 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.
        def paths_to_push
          directories.map {|dir| "'#{ File.expand_path(dir) }'" }.join(' ')
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
backup-3.6.0 lib/backup/syncer/rsync/base.rb
backup-3.5.1 lib/backup/syncer/rsync/base.rb
backup-3.5.0 lib/backup/syncer/rsync/base.rb
backup-3.4.0 lib/backup/syncer/rsync/base.rb
backup-3.3.2 lib/backup/syncer/rsync/base.rb
backup-3.3.1 lib/backup/syncer/rsync/base.rb
backup-3.3.0 lib/backup/syncer/rsync/base.rb
backup-3.2.0 lib/backup/syncer/rsync/base.rb