Sha256: 387322b645fb3bdf56a54b5394ab61d78c0c6fa196a3891db0145691047653b6

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

module Middleman
  module Deploy
    module Methods
      class Rsync < Base
        attr_reader :clean, :flags, :host, :path, :port, :user

        def initialize(server_instance, options = {})
          super(server_instance, options)

          @clean  = self.options.clean
          @flags  = self.options.flags
          @host   = self.options.host
          @path   = self.options.path
          @port   = self.options.port
          @user   = self.options.user
        end

        def process
          # Append "@" to user if provided.
          user      = "#{self.user}@" if user && !user.empty?

          dest_url  = "#{user}#{host}:#{path}"
          flags     = self.flags || '-avz'
          command   = "rsync #{flags} '-e ssh -p #{port}' #{build_dir}/ #{dest_url}"

          command += ' --delete' if clean

          puts "## Deploying via rsync to #{dest_url} port=#{port}"
          exec command
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-deploy-2.0.0.pre.alpha lib/middleman-deploy/methods/rsync.rb