Sha256: 4a10a990e1bad8749ccae13571e6fca5a829f6d1d1846250e86430f697fd3c79

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

#
# these methods are made available in capistrano tasks as 'rsync.method_name'
# (see RemoteCommand::new_capistrano)
#

autoload :RsyncCommand, 'rsync_command'

module LeapCli; module Remote; module RsyncPlugin

  #
  # takes a block, yielded a server, that should return a hash with various rsync options.
  # supported options include:
  #
  #   {:source => '', :dest => '', :flags => '', :includes => [], :excludes => []}
  #
  def update
    rsync = RsyncCommand.new(:logger => logger)
    rsync.asynchronously(find_servers) do |server|
      options = yield server
      next unless options
      remote_user = server.user || fetch(:user, ENV['USER'])
      src = options[:source]
      dest = {:user => remote_user, :host => server.host, :path => options[:dest]}
      options[:ssh] = ssh_options.merge(server.options[:ssh_options]||{})
      options[:chdir] ||= Path.provider
      rsync.exec(src, dest, options)
    end
    if rsync.failed?
      LeapCli::Util.bail! do
        LeapCli::Util.log :failed, "to rsync to #{rsync.failures.map{|f|f[:dest][:host]}.join(' ')}"
      end
    end
  end

end; end; end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
leap_cli-1.8.1 lib/leap_cli/remote/rsync_plugin.rb
leap_cli-1.8 lib/leap_cli/remote/rsync_plugin.rb
leap_cli-1.7.4 lib/leap_cli/remote/rsync_plugin.rb
leap_cli-1.7.3 lib/leap_cli/remote/rsync_plugin.rb
leap_cli-1.6.2 lib/leap_cli/remote/rsync_plugin.rb