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

View File

@ -7,7 +7,7 @@ read -p "Repository Username [$my_user_tmp]: " my_user
: ${my_user:="$my_user_tmp"}
while [ -z "${my_site:-}" ]; do
read -p "Site name (ex: example.com): " my_site
read -p "Site name (ex: example.com): " my_site
done
my_repo_tmp=$(eval echo "~$my_user")
@ -19,7 +19,7 @@ read -p "Deploy to [/srv/www/$my_site]: " my_deploy
my_pretty="x"
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
echo ""
@ -37,8 +37,12 @@ EOF
"
if [ "y" == "$my_pretty" ]; then
# TODO test for / install 'prettier'
sudo rsync -av hooks/update.format.full "${my_repo}/hooks/update"
# TODO test for / install 'prettier'
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
sudo chmod -R a+x "${my_repo}/hooks/"