Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tomlea
Created August 1, 2013 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tomlea/6132757 to your computer and use it in GitHub Desktop.
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
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/^git@heroku.com:([^.]*)\.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