Created
August 1, 2013 16:02
-
-
Save tomlea/6132757 to your computer and use it in GitHub Desktop.
When you have multiple heroku apps, for one repo, you're going to need a hero! hero production run rake db:migrate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _hero_getRemoteNames(){ | |
git config --get-regexp remote.*.url heroku.com | | |
sed -E 's/^remote\.([^\.]*)\.url .*$/\1/' | |
} | |
function _hero_herokuAppFor(){ | |
git config --get remote.$1.url | | |
sed -E 's/^[email protected]:([^.]*)\.git/\1/' | |
} | |
function _hero_complete(){ | |
if [ "$1" == "$3" ] | |
then | |
COMPREPLY=(`_hero_getRemoteNames | grep -E "^$2"`) | |
else | |
COMPREPLY=() | |
fi | |
} | |
complete -F _hero_complete -o default hero | |
function hero(){ | |
APP=$(_hero_herokuAppFor $1) | |
shift | |
HEROKU_APP=$APP heroku $* | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment