Moved Git hooks to the .githooks directory, and created make init script.

This commit is contained in:
Wen Kokke 2020-08-19 22:13:39 +02:00
parent ec4694070e
commit b5d69ff010
3 changed files with 22 additions and 2 deletions

12
.githooks/pre-commit Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
#
# Check if fix-whitespace is installed, and if so, run it.
#
if ! command -v fix-whitespace &> /dev/null
then
echo "fix-whitespace could not be found"
exit
else
fix-whitespace --check
fi

View file

@ -28,6 +28,11 @@ SEDI := sed -i
endif endif
# Configure the repository to use .githooks
init:
git config core.hooksPath .githooks
# Build PLFA web version and test links # Build PLFA web version and test links
default: test default: test

View file

@ -143,15 +143,17 @@ You'll see the key sequence of the character in mini buffer.
PLFA is available as both a website and an EPUB e-book, both of which can be built on Linux and macOS. PLFA is available as both a website and an EPUB e-book, both of which can be built on Linux and macOS.
PLFA is written in literate Agda with [Kramdown Markdown][kramdown]. PLFA is written in literate Agda with [Kramdown Markdown][kramdown].
### Git hooks ### Git hooks
The repository comes with several pre-commit Git hooks installed: The repository comes with several Git hooks:
1. The [fix-whitespace][fix-whitespace] program is run to check for whitespace violations. 1. The [fix-whitespace][fix-whitespace] program is run to check for whitespace violations.
2. The test suite is run to check if everything type checks. 2. The test suite is run to check if everything type checks.
If you dont have [fix-whitespace][fix-whitespace] installed, you can circumvent the pre-commit Git hooks by passing `--no-verify`. You can install these Git hooks by calling `make init`.
### Building the website ### Building the website
@ -198,6 +200,7 @@ bundle install
bundle exec jekyll serve bundle exec jekyll serve
``` ```
### Building the EPUB ### Building the EPUB
The [EPUB version][epub] of the book is built using Pandoc. The [EPUB version][epub] of the book is built using Pandoc.