Sha256: ca8d1728fb717fc43929f2028def0820ee5f6a8674ba94a196c004a4bcfb1801

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8

module Backup
  module Syncer
    module RSync
      class Base < Syncer::Base
        ##
        # Additional options for the rsync cli
        attr_accessor :additional_options

        ##
        # Instantiates a new RSync Syncer object
        # and sets the default configuration
        def initialize
          super

          @additional_options ||= Array.new
        end

        private

        ##
        # Returns the @directories as a space-delimited string of
        # single-quoted values for use in the `rsync` command line.
        # Each path is expanded, since these refer to local paths
        # for both RSync::Local and RSync::Push.
        # RSync::Pull does not use this method.
        def directories_option
          @directories.map do |directory|
            "'#{ File.expand_path(directory) }'"
          end.join(' ')
        end

        ##
        # Returns Rsync syntax for enabling mirroring
        def mirror_option
          '--delete' if @mirror
        end

        ##
        # Returns Rsync syntax for invoking "archive" mode
        def archive_option
          '--archive'
        end

      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
backup-3.1.3 lib/backup/syncer/rsync/base.rb
backup-3.1.2 lib/backup/syncer/rsync/base.rb
backup-3.1.1 lib/backup/syncer/rsync/base.rb
backup-3.1.0 lib/backup/syncer/rsync/base.rb
backup-agoddard-3.0.28 lib/backup/syncer/rsync/base.rb
backup-agoddard-3.0.27 lib/backup/syncer/rsync/base.rb
ey-vendored-backup-3.0.27 lib/backup/syncer/rsync/base.rb
backup-3.0.27 lib/backup/syncer/rsync/base.rb
backup-3.0.26 lib/backup/syncer/rsync/base.rb
backup-3.0.25 lib/backup/syncer/rsync/base.rb
backup-3.0.24 lib/backup/syncer/rsync/base.rb