Created
August 16, 2009 08:39
-
-
Save jackprophesy/168589 to your computer and use it in GitHub Desktop.
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
#SWITCHES | |
#-d (cap deploy when check-in finished) | |
#-v (verbose, defaults to quiet) | |
#-m "commit message" (custom commit message) | |
#!/bin/bash | |
## options to be accepted | |
optstr=m:dv ## colon follows options that require an argument | |
while getopts $optstr var | |
do | |
case $var in | |
v) verbose="-v" ;; | |
d) deploy=1;; | |
m) message=$OPTARG ;; | |
esac | |
done | |
shift $(( $OPTIND - 1 )) | |
verbose=${verbose:-"-q"} | |
deploy=${deploy:-0} | |
defaultmessage=${message:-"No commit message provided"} | |
if [ $verbose = "-v" ]; then | |
echo -e '\E[0;32mAdding updated files to commit...\E[1;37m' | |
git add -Av | |
echo -e '\E[0;32mCommitting...\E[1;37m' | |
git commit -a -m "$defaultmessage" -v | |
echo -e '\E[0;32mPushing to origin master...\E[1;37m' | |
git push -v origin master | |
else | |
echo -e '\E[0;32mAdding updated files to commit...\E[1;37m' | |
git add -A | |
echo -e '\E[0;32mCommitting...\E[1;37m' | |
git commit -a -q -m "$defaultmessage" | |
echo -e '\E[0;32mPushing to origin master...\E[1;37m' | |
git push origin master | |
fi | |
if [ $deploy = 1 ]; then | |
echo -e '\E[0;32mDeploying...\E[1;37m' | |
if [ $verbose = "-v" ]; then | |
cap deploy -v | |
else | |
cap deploy -q | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment