Skip to content

Instantly share code, notes, and snippets.

@patmcnally
Created March 2, 2016 17:14
Show Gist options
  • Save patmcnally/14004f9c688e2b5bf674 to your computer and use it in GitHub Desktop.
Save patmcnally/14004f9c688e2b5bf674 to your computer and use it in GitHub Desktop.
repo=$(git rev-parse --show-toplevel);
repo="${repo/\/Volumes\/CODE\//}";
repo="${repo/\/var\/www\/html\/announcemedia\//}";
branch=`git rev-parse --abbrev-ref HEAD`;
if [ "$branch" == "HEAD" ]; then
branch="";
else
branch="(BRANCH: $branch)";
fi;
deploy="# $(basename "$repo") $branch";
nl="
";
if [ ${repo:0:15} == "sql_deployments" ]; then
deploy="$deploy${nl}cd /var/www/html/announcemedia/$repo;${nl}sudo gitsqldeploy $(git rev-parse HEAD);";
elif [ ${repo} == "server_configs" ]; then
deploy="$deploy${nl}cd /var/www/html/announcemedia/$repo;${nl}sudo gitswitch $(git rev-parse HEAD);${nl}# restart apache${nl}sudo /etc/init.d/httpd reload;";
else
deploy="$deploy${nl}cd /var/www/html/announcemedia/$repo;${nl}sudo gitswitch $(git rev-parse HEAD);";
fi;
echo "$deploy" | pbcopy;
printf "${deploy}\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment