def remote_setup if branch.eql? "master" checkout = "" else checkout = "&& $(git branch | grep -vq #{branch}) && git checkout -f -b #{branch} origin/#{branch}" end remote_run "cd #{path} && #{@sudo}git clone --depth 1 #{repository} #{application} && cd #{application} #{checkout}" install_gems remote_run "#{@sudo}rake inploy:setup environment=#{environment}" end