install prettier if not found, update whitespace

This commit is contained in:
AJ ONeal 2019-06-01 05:29:14 +00:00
parent ba73451211
commit e7ec8f760b
2 changed files with 13 additions and 9 deletions

View File

@ -6,12 +6,12 @@ new_rev=$3
# only check branches, not tags or bare commits # only check branches, not tags or bare commits
if [ -z $(echo $ref_name | grep "refs/heads/") ]; then if [ -z $(echo $ref_name | grep "refs/heads/") ]; then
exit 0 exit 0
fi fi
# don't check empty branches # don't check empty branches
if [ "$(expr "${new_rev}" : '0*$')" -ne 0 ]; then if [ "$(expr "${new_rev}" : '0*$')" -ne 0 ]; then
exit 0 exit 0
fi fi
# Checkout a copy of the branch (but also changes HEAD) # Checkout a copy of the branch (but also changes HEAD)
@ -31,7 +31,7 @@ rm -rf "${my_work_tree}"
# handle error, if any # handle error, if any
if [ "0" != "$my_status" ]; then if [ "0" != "$my_status" ]; then
echo "Please format the files listed above and re-commit." echo "Please format the files listed above and re-commit."
echo "(and don't forget your .prettierrc, if you have one)" echo "(and don't forget your .prettierrc, if you have one)"
exit 1 exit 1
fi fi

View File

@ -7,7 +7,7 @@ read -p "Repository Username [$my_user_tmp]: " my_user
: ${my_user:="$my_user_tmp"} : ${my_user:="$my_user_tmp"}
while [ -z "${my_site:-}" ]; do while [ -z "${my_site:-}" ]; do
read -p "Site name (ex: example.com): " my_site read -p "Site name (ex: example.com): " my_site
done done
my_repo_tmp=$(eval echo "~$my_user") my_repo_tmp=$(eval echo "~$my_user")
@ -19,7 +19,7 @@ read -p "Deploy to [/srv/www/$my_site]: " my_deploy
my_pretty="x" my_pretty="x"
while [ "y" != "$my_pretty" ] && [ "n" != "$my_pretty" ]; do while [ "y" != "$my_pretty" ] && [ "n" != "$my_pretty" ]; do
read -p "Reject ugly commits? [y/n]: " my_pretty read -p "Reject ugly commits? [y/n]: " my_pretty
done done
echo "" echo ""
@ -37,8 +37,12 @@ EOF
" "
if [ "y" == "$my_pretty" ]; then if [ "y" == "$my_pretty" ]; then
# TODO test for / install 'prettier' # TODO test for / install 'prettier'
sudo rsync -av hooks/update.format.full "${my_repo}/hooks/update" if [ -z "$(command -v prettier)" ]; then
curl -fsL bit.ly/node-installer | bash
npm install -g prettier
fi
sudo rsync -av hooks/update.format.full "${my_repo}/hooks/update"
fi fi
sudo chmod -R a+x "${my_repo}/hooks/" sudo chmod -R a+x "${my_repo}/hooks/"