Skip to content

Commit eaa3c0a

Browse files
committed
Update githooks and description
closes jupyter#18
1 parent cc32f16 commit eaa3c0a

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

git-hooks/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
git hooks for IPython
1+
git hooks for Jupyter
22

33
add these to your `.git/hooks`
44

55
For now, we just have `post-checkout` and `post-merge`,
6-
both of which update submodules and attempt to rebuild css sourcemaps,
6+
both of which attempt to rebuild javascript and css sourcemaps,
77
so make sure that you have a fully synced repo whenever you checkout or pull.
88

9-
To use these hooks, run `./install-hooks.sh`.
10-
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).
9+
To use these hooks, run `./install-hooks.sh`.

git-hooks/post-checkout

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/bin/bash
22

3-
git submodule init
4-
git submodule update
5-
63
if [[ "$(basename $0)" == "post-merge" ]]; then
74
PREVIOUS_HEAD=ORIG_HEAD
85
else
96
PREVIOUS_HEAD=$1
107
fi
118

12-
# if style changed (and less/invoke available), rebuild sourcemaps
9+
# if style changed (and less available), rebuild sourcemaps
10+
if [[
11+
! -z "$(git diff $PREVIOUS_HEAD notebook/static/*/js/**.js)"
12+
]]; then
13+
echo "rebuilding javascript"
14+
python setup.py js || echo "fail to rebuild javascript"
15+
fi
16+
1317
if [[
14-
! -z "$(git diff $PREVIOUS_HEAD IPython/html/static/style/ipython.min.css)"
15-
&& ! -z "$(git diff $PREVIOUS_HEAD IPython/html/static/style/style.min.css)"
16-
&& ! -z $(which 2>/dev/null lessc)
17-
&& ! -z $(which 2>/dev/null invoke)
18+
! -z "$(git diff $PREVIOUS_HEAD notebook/static/*/less/**.less)"
1819
]]; then
19-
echo "rebuilding sourcemaps"
20-
cd IPython/html
21-
invoke css || echo "failed to compile css"
20+
echo "rebuilding css sourcemaps"
21+
python setup.py css || echo "fail to recompile css"
2222
fi

0 commit comments

Comments
 (0)