Created
July 12, 2013 02:45
-
-
Save TechplexEngineer/5981040 to your computer and use it in GitHub Desktop.
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
| Host gh | |
| HostName github.com | |
| User git | |
| Host pt-git | |
| HostName blake.metheus.org | |
| User git | |
| Host pt | |
| HostName blake.metheus.org | |
| User techplex | |
| Host rpi | |
| HostName blake.team2648.com | |
| User techplex | |
| IdentityFile /home/techplex/.ssh/rpi |
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
| #!/bin/bash | |
| #path to production files | |
| livePath="/var/www/plextex" | |
| #path to devel files | |
| devPath="/var/www/dev.plextex" | |
| #path to the headless repo | |
| repoLoc="/home/git/plextex.git" | |
| #$1 = directory to ensure access | |
| assert_dir_access() { | |
| (cd ${1:?pathname expected}) || exit | |
| } | |
| #$1 = the path to the root site | |
| laravel_storage_perms() { | |
| cd $1 | |
| chmod -R g+w storage | |
| chgrp -R www-data storage | |
| } | |
| #$1 = path | |
| #$2 = branch | |
| git_checkout_latest() { | |
| GIT_WORK_TREE=$1 git checkout -f $2 | |
| } | |
| while read oldrev newrev refname | |
| do | |
| branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
| if [ "master" == "$branch" ]; then | |
| assert_dir_access $livePath | |
| git_checkout_latest $livePath $branch | |
| laravel_storage_perms $livePath | |
| echo "Update pushed to develop branch" | |
| elif [ "$branch" = "develop" ] ; then | |
| assert_dir_access $devPath | |
| git_checkout_latest $devPath $branch | |
| laravel_storage_perms $devPath | |
| echo "Update pushed to develop branch" | |
| else | |
| echo "Error: Unrecognized Branch: $branch" | |
| fi | |
| done |
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
| #!/bin/bash | |
| #start | |
| rm -rf plextex.git/ | |
| git init --bare plextex.git | |
| ln -s /home/git/post-receive /home/git/plextex.git/hooks/ | |
| #stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment