lib/dotfileleader/rsync.rb
def run_rsync(options = {})

  # Ensure the rsync binary is present
  is_rsync_installed()

  if options[:is_ssh] == true
    args = "-e ssh -vaP"
  else
    args = "-vaP"
  end
  src_path = options[:src_path]
  dst_path = options[:dst_path]
  rsync_cmd = Mixlib::ShellOut.new("rsync #{args} #{src_path} #{dst_path}")
  rsync_cmd.run_command()

  #pprint(rsync_cmd)
  if rsync_cmd.exitstatus == 0
    if options[:verbose] == true
      puts "----\nrsync output:"
      puts rsync_cmd.stdout
      puts "----"
    end
    puts "Successfully synced #{src_path} to #{dst_path}"
  else
      puts rsync_cmd.exitstatus
      pprint(rsync_cmd.stdout)
  end

end
# Syncs the source and destination using rsync
# - assumes that the destination is remote
# - Will give additional output if --verbose is included
#   on the command line
# - has error handling
Syncs the source and destination using rsync
assumes that the destination is remote
Will give additional output if --verbose is included
on the command line
has error handling
Syncs the source and destination using rsync assumes that the destination is remote Will give additional output if -- verbose is included on the command line has error handling
def run_rsync(options = {})
  is_rsync_installed()
  if options[:is_ssh] == true
    args = "-e ssh -vaP"
  else
    args = "-vaP"
  end
  src_path = options[:src_path]
  dst_path = options[:dst_path]
  rsync_cmd = Mixlib::ShellOut.new("rsync #{args} #{src_path} #{dst_path}")
  rsync_cmd.run_command()
  if rsync_cmd.exitstatus == 0
    if options[:verbose] == true
      puts "----\nrsync output:"
      puts rsync_cmd.stdout
      puts "----"
    end
    puts "Successfully synced #{src_path} to #{dst_path}"
  else
      puts rsync_cmd.exitstatus
      pprint(rsync_cmd.stdout)
  end
end
def run_rsync ( options = { } ) is_rsync_installed ( ) if options [ :is_ssh ] == true args = "-e ssh -vaP" else args = "-vaP" end src_path = options [ :src_path ] dst_path = options [ :dst_path ] rsync_cmd = Mixlib :: ShellOut . new ( "rsync #{args} #{src_path} #{dst_path}" ) rsync_cmd . run_command ( ) if rsync_cmd . exitstatus == 0 if options [ :verbose ] == true puts "----\nrsync output:" puts rsync_cmd . stdout puts "----" end puts "Successfully synced #{src_path} to #{dst_path}" else puts rsync_cmd . exitstatus pprint ( rsync_cmd . stdout ) end end
Syncs the source and destination using rsync
 assumes that the destination is remote
 Will give additional output if --verbose is included
on the command line
 has error handling
Syncs the source and destination using rsync assumes that the destination is remote Will give additional output if -- verbose is included on the command line has error handling
# Ensure the rsync binary is present #pprint(rsync_cmd)
options