#!/bin/bash -e if ! echo "$hst_this" | egrep "^(admin|develop)"; then # ssh into deploy host and run from there exec bin/proxy $(basename $0) "$@" exit 1 fi case "$(basename $0)" in deploy|release) bundle exec cap ssh_gateway "$@" deploy ;; rollback) bundle exec cap ssh_gateway "$@" deploy:rollback ;; stage) bundle exec cap ssh_gateway "$@" deploy:update_code ;; compare) bundle exec cap ssh_gateway "$@" deploy:compare ;; restart) bundle exec cap ssh_gateway "$@" deploy:restart ;; restart) bundle exec cap ssh_gateway "$@" deploy:restart ;; build) bundle exec cap ssh_gateway "$@" deploy:build ;; dist) bundle exec cap ssh_gateway "$@" deploy:dist ;; config) bundle exec cap ssh_gateway "$@" deploy:config ;; invoke) bundle exec cap ssh_gateway "$@" invoke ;; shell) bundle exec cap ssh_gateway "$@" shell ;; hosts) export LOCAL_ONLY=true { cap $(for a in "$@"; do echo $a.echo; done) } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u ;; dna) export LOCAL_ONLY=true { cap $(for a in "$@"; do echo $a.yaml; done) } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##' ;; *) bundle exec cap ssh_gateway "$@" ;; esac