def put_sudo(data, to)
      filename = File.basename(to)
      to_directory = File.dirname(to)
      put data, "/tmp/#{filename}"
      run "#{sudo} mv /tmp/#{filename} #{to_directory}"
    end
def put_sudo(data, to)
      filename = File.basename(to)
      to_directory = File.dirname(to)
      put data, "/tmp/#{filename}"
      run "#{sudo} mv /tmp/#{filename} #{to_directory}"
    end
https://gist.github.com/mklnz/2407925