Update githooks and description

closes #18
This commit is contained in:
Matthias Bussonnier 2015-09-16 11:38:06 -07:00
parent cc32f165e8
commit eaa3c0ac36
2 changed files with 14 additions and 15 deletions

View File

@ -1,10 +1,9 @@
git hooks for IPython
git hooks for Jupyter
add these to your `.git/hooks`
For now, we just have `post-checkout` and `post-merge`,
both of which update submodules and attempt to rebuild css sourcemaps,
both of which attempt to rebuild javascript and css sourcemaps,
so make sure that you have a fully synced repo whenever you checkout or pull.
To use these hooks, run `./install-hooks.sh`.
If you havn't initialised and updated the submodules manually, you will then need to run `git checkout master` to activate the hooks (even if you already have `master` checked out).
To use these hooks, run `./install-hooks.sh`.

View File

@ -1,22 +1,22 @@
#!/bin/bash
git submodule init
git submodule update
if [[ "$(basename $0)" == "post-merge" ]]; then
PREVIOUS_HEAD=ORIG_HEAD
else
PREVIOUS_HEAD=$1
fi
# if style changed (and less/invoke available), rebuild sourcemaps
# if style changed (and less available), rebuild sourcemaps
if [[
! -z "$(git diff $PREVIOUS_HEAD IPython/html/static/style/ipython.min.css)"
&& ! -z "$(git diff $PREVIOUS_HEAD IPython/html/static/style/style.min.css)"
&& ! -z $(which 2>/dev/null lessc)
&& ! -z $(which 2>/dev/null invoke)
! -z "$(git diff $PREVIOUS_HEAD notebook/static/*/js/**.js)"
]]; then
echo "rebuilding sourcemaps"
cd IPython/html
invoke css || echo "failed to compile css"
echo "rebuilding javascript"
python setup.py js || echo "fail to rebuild javascript"
fi
if [[
! -z "$(git diff $PREVIOUS_HEAD notebook/static/*/less/**.less)"
]]; then
echo "rebuilding css sourcemaps"
python setup.py css || echo "fail to recompile css"
fi