def deploy_git_ref(rest_app, ref, hot_deploy, force_clean_build)
say "Deployment of git ref '#{ref}' in progress for application #{rest_app.name} ..."
ssh_url = URI(rest_app.ssh_url)
remote_cmd = "gear deploy #{ref}#{hot_deploy ? ' --hot-deploy' : ''}#{force_clean_build ? ' --force-clean-build' : ''}"
begin
ssh_ruby(ssh_url.host, ssh_url.user, remote_cmd)
success "Success"
rescue
ssh_cmd = "ssh -t #{ssh_url.user}@#{ssh_url.host} '#{remote_cmd}'"
warn "Error deploying git ref. You can try to deploy manually with:\n#{ssh_cmd}"
raise
end
end