Created
April 2, 2013 20:43
-
-
Save Whitespace/5296004 to your computer and use it in GitHub Desktop.
Some helper functions for heroku deploys. This uses the heroku cli's -r feature to run commands on a git remote, so you need git remotes for production and staging to respectively named.
This file contains hidden or 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 p { | |
command=$1 | |
shift 1 | |
heroku $command -r production $@ | |
} | |
function s { | |
command=$1 | |
shift 1 | |
heroku $command -r staging $@ | |
} | |
function log { | |
local environment=$1 | |
local type=$2 | |
local source_and_process | |
local IFS='.' | |
shift 2 | |
read -ra source_and_process <<< "$type" | |
local source="${source_and_process[0]}" | |
local process="${source_and_process[1]}" | |
if [ -z "$process" ] | |
then | |
set -x | |
$environment logs -s $source $@ | |
set +x | |
else | |
set -x | |
$environment logs -s $source -p $process $@ | |
set +x | |
fi | |
} | |
function deploy { | |
env=$1 | |
shift 1 | |
echo "say \"Deploying to $env\" && git push $env $@ && say \"Deploy to $env complete\"" | |
say "Deploying to $env" && git push $env $@ && say "Deploy to $env complete" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment