Created
February 5, 2014 07:57
-
-
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!
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
#!/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