Sha256: 4d8e84b1c5543342ae4c7414c9c86277fe623d0086067bee699cf6b934efb2ad

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

# encoding: utf-8

module Backup
  module Syncer
    module RSync
      class Local < Base

        ##
        # Instantiates a new RSync::Local Syncer object.
        # Default configuration values and any specified in
        # Backup::Configuration::Syncer::RSync::Local are set from Base.
        # The user's configuration file is then evaluated to overwrite
        # these values or provide additional configuration.
        def initialize(&block)
          super

          instance_eval(&block) if block_given?
        end

        ##
        # Performs the RSync::Local operation
        # debug options: -vhP
        def perform!
          Logger.message(
            "#{ syncer_name } started syncing the following directories:\n\s\s" +
            @directories.join("\n\s\s")
          )
          Logger.silent(
            run("#{ utility(:rsync) } #{ options } " +
                "#{ directories_option } '#{ dest_path }'")
          )
        end

        private

        ##
        # Return expanded @path
        def dest_path
          @dest_path ||= File.expand_path(@path)
        end

        ##
        # Returns all the specified Rsync::Local options,
        # concatenated, ready for the CLI
        def options
          ([archive_option, mirror_option] +
            additional_options).compact.join("\s")
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
backup_checksum-3.0.23 lib/backup/syncer/rsync/local.rb
backup-3.0.23 lib/backup/syncer/rsync/local.rb
backup-3.0.22 lib/backup/syncer/rsync/local.rb
backup-3.0.21 lib/backup/syncer/rsync/local.rb