Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

STIJ-195: Added pre-commit hook support. #170

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to `digipolisgent/fractal_styleguide_gent-base`.

### 2.7.1
* STIJ-193: Added figcaption atom and figure molecule.
* STIJ-195: Added Git pre commit hook support in the gulpfile.

### 2.7.0
**IMPORTANT: Class .text-center has been removed**
Expand Down
8 changes: 5 additions & 3 deletions postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ if [ -d "./public" ]; then

mkdir ./public/styleguide/vendor;

cp -R node_modules/lightgallery ./public/styleguide/vendor/lightgallery;
cp -R node_modules/jquery ./public/styleguide/vendor/jquery;
cp -R node_modules/chosen-js ./public/styleguide/vendor/chosen-js;
cp -R ./node_modules/lightgallery ./public/styleguide/vendor/lightgallery;
cp -R ./node_modules/jquery ./public/styleguide/vendor/jquery;
cp -R ./node_modules/chosen-js ./public/styleguide/vendor/chosen-js;

cp ./scripts/pre-commit ./.git/hooks/pre-commit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer something more clear for the git-hooks e.g. a .git-hooks folder which is also hidden on the filesystem by default.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use symlink instead of copy.
No support for windows users?

fi
16 changes: 16 additions & 0 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# pre-commit

echo 'Testing the validity of your code...';

# Ensure that code that isn't part of the prospective commit isn't tested within your pre-commit script
git stash -q --keep-index

# Test prospective commit
gulp validate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer something that uses the package manager as wrapper to have uniformity. E.g. npm pre-commit. For PHP projects we could use composer pre-commit.


RESULT=$?

git stash pop -q

[ $RESULT -ne 0 ] && exit 1
exit 0