Fix spelling error.
[lw2-viewer.git] / pre-commit.hook
blob5ebfe9e0bbe358ec471e41c59b4844aee5608eb1
1 #!/bin/bash
3 set -e
5 SYSTEMS=(Mac Windows Linux)
6 SUFFIXES=(.mac.css .windows.css .linux.css)
8 if [[ "$1" = "--force" ]] || ! git diff-index --quiet --cached HEAD -- www/style.css.php www/style_mobile_additions.css.php color-scheme-convert.php www/theme\* www/ea/\*.css.php www/accordius/\*.css.php ; then
9 git ls-files --cached HEAD 'www/theme-*' |while read F; do
10 IN="${F#www/}"
11 OUTBASE="css/style${IN#theme}"
12 OUTBASE="${OUTBASE%.php}"
13 OUTBASE="${OUTBASE%.css}"
14 OUTBASE="${OUTBASE%-default}"
15 for N in ${!SYSTEMS[*]}; do
16 OUT="${OUTBASE}${SUFFIXES[N]}"
17 git show :www/style.css.php | (cd www; php -- ${SYSTEMS[N]} "$IN" >"$OUT")
18 git add www/"$OUT"
19 done
20 done
21 for N in ${!SYSTEMS[*]}; do
22 cp www/style-dark-preamble.css www/css/style-dark${SUFFIXES[N]}
23 php color-scheme-convert.php www/css/style${SUFFIXES[N]} 3 >>www/css/style-dark${SUFFIXES[N]}
24 git add www/css/style${SUFFIXES[N]} www/css/style-dark${SUFFIXES[N]}
25 done
26 git show :www/theme_tweaker.css.php | (cd www; php >css/theme_tweaker.css)
27 git add www/css/theme_tweaker.css