Skip to content
cdmgtri edited this page Feb 10, 2021 · 1 revision

NIEM Code Lists Specification wiki

Build tips

In addition to the standard specification build steps, set up a git pre-commit hook to automatically copy the latest build into the /docs/draft directory before a commit is made on the dev branch. Pre-commit hooks are local, so each specification editor should set this up in their cloned repo.

  1. Go to .git/hooks/pre-commit.sample and remove the .sample extension
  2. Replace the contents of the pre-commit with the code below.
    It checks to determine if the user is on the dev branch, and if so, it copies build files to /docs/draft and adds it to the current commit operation in progress.
#!/bin/sh

BRANCH=`git rev-parse --abbrev-ref HEAD`

if [[ "$BRANCH" == "dev" ]]; then

  cp niem-code-lists* docs/draft/
  cp code-lists* docs/draft/
  cp -r example docs/draft/

  git add docs/draft

  echo "[Git pre-commit hook for branch 'dev']: Copied files to /docs/draft for GitHub Pages."

fi
Clone this wiki locally