Sha256: f41e0d717d42d18a5d9fbde0d07e94b20730780986eb141a199bac760f0166b5

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

require "pty"
module Mccloud
  module Util
    def self.rsync(path,vm,instance)
      unless !File.exists?(path)
        env.logger.info "[#{vm.name}] - rsyncing #{path}"
        command="rsync  --exclude='.DS_Store' --exclude='.git' --exclude='.hg' --delete --delete-excluded  -az -e 'ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \"#{vm.private_key}\"' '#{path}/' '#{vm.user}@#{instance.public_ip_address}:/tmp/#{File.basename(path)}/'"
      else
        raise Mccloud::Error, "[#{vm.name}] - rsync error: #{path} does no exist"
      end
    begin
      PTY.spawn( command ) do |r, w, pid|
        begin
          r.each { |line| print line;}
       rescue Errno::EIO
       end
     end
   rescue PTY::ChildExited => e
      puts "The child process exited!"
         end
      #Kernel.exec(command)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mccloud-0.0.15 lib/mccloud/util/rsync.rb
mccloud-0.0.14 lib/mccloud/util/rsync.rb