Skip to content

Instantly share code, notes, and snippets.

@Mte90 Mte90/pre-push.sh
Created Apr 12, 2018

Embed
What would you like to do?
pre-push
#!/bin/sh
# If the branch is not master, execute phpmetrics and upoload everything on the VPS
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $current_branch != "master" ]; then
phpmetrics --report-html="/tmp/your-report" /var/www/VVV/www/your-project/htdocs/wp-content/plugins/your-plugin/ --config=phpmetrics.ini > /dev/null
sshpass -p your-password rsync --exclude={.sass-cache*,*.map,node_modules,.php_cs,.git*,*.lock,*.yml,*lock.json} --progress -avz /tmp/your-report -e ssh user@domain.tld:/var/www/your-metrics/$current_branch/ > /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.