Skip to content

Instantly share code, notes, and snippets.

@adamsp
Created February 5, 2014 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamsp/8819046 to your computer and use it in GitHub Desktop.
Save adamsp/8819046 to your computer and use it in GitHub Desktop.
Simple script to update my Octopress blog and push changes to git in one go. Now I type one command instead of 5!
#!/bin/bash
ERR_SITE_GEN=1
ERR_SITE_DEPLOY=2
ERR_GIT_ADD=3
ERR_GIT_COMMIT=4
ERR_GIT_PUSH=5
ERR_NO_COMMIT_MESSAGE=6
if [ $# -eq 0 ]; then
echo "You must specify a commit message. No quotes or flags required."
exit ERR_NO_COMMIT_MESSAGE
elif ! rake generate; then
echo "Error generating site."
exit $ERR_SITE_GEN
elif ! rake deploy; then
echo "Error deploying site."
exit $ERR_SITE_DEPLOY
elif ! git add .; then
echo "Error adding files to git."
exit $ERR_GIT_ADD
elif ! git commit -a -m "$*"; then
echo "Error committing files to git."
exit $ERR_GIT_COMMIT
elif ! git push; then
echo "Error pushing to git."
exit $ERR_GIT_PUSH
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment