diff --git a/hooks/update.format.minimal b/hooks/update.format.minimal index be50c34..021c118 100755 --- a/hooks/update.format.minimal +++ b/hooks/update.format.minimal @@ -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 diff --git a/new-deployable-site.sh b/new-deployable-site.sh index b52ab53..b16fac6 100755 --- a/new-deployable-site.sh +++ b/new-deployable-site.sh @@ -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/"