From 7523b714051ad4c6df6cbb3b86442dfb5ddaaa86 Mon Sep 17 00:00:00 2001 From: James Ramsay Date: Thu, 31 Dec 2015 17:11:32 +1100 Subject: [PATCH] Docs: init script (closes #132) --- CONTRIBUTING.md | 8 ++++++++ scripts/init | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 scripts/init diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68120c82..1e784e99 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,6 +3,14 @@ If you want to contribute to Hercule, please use a GitHub pull request. This is the fastest way for features and fixes to be reviewed and merged it into the code base. +To do this, clone the repo and run: + +```bash +./scripts/init +``` + +This will install the necessary dependencies and configure project git hooks. + ## Getting started The process of submitting a pull request is fairly straightforward and generally follows the same pattern each time: diff --git a/scripts/init b/scripts/init new file mode 100755 index 00000000..41d28d1d --- /dev/null +++ b/scripts/init @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# Script to initialize repo +# - install required node packages +# - install git hooks + + +node=`which node 2>&1` +if [ $? -ne 0 ]; then + echo "Please install NodeJS." + echo "http://nodejs.org/" + exit 1 +fi + +npm=`which npm 2>&1` +if [ $? -ne 0 ]; then + echo "Please install NPM." +fi + + +echo "Installing required npm packages..." +npm install + +echo "Installing git hooks..." +ln -sf commit-msg .git/hooks/commit-msg +ln -sf pre-commit .git/hooks/pre-commit