Skip to content

Instantly share code, notes, and snippets.

@mattbierner
Last active January 3, 2016 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbierner/8529020 to your computer and use it in GitHub Desktop.
Save mattbierner/8529020 to your computer and use it in GitHub Desktop.
khepri git hook
#!/bin/sh
KHEPRI="khepri"
OPTIONS=""
SRC=lib
DEST=dist
DEST_NODE=dist_node
function _compile {
local file=$1
local path=${file##*/}
local out=$2
$KHEPRI -o $out $1 $3
OUT=$?
if [ $OUT -ne 0 ]; then
exit 1
fi
git add $out
}
for file in $(git diff --cached --name-only --diff-filter=ACM)
do
if [[ $file =~ $SRC/.+\.kep ]];
then
# AMD
path="${DEST}${file#$SRC}"
out="${path%.kep}.js"
_compile $file $out ""
# NODE
path_node="${DEST_NODE}${file#$SRC}"
out_node="${path_node%.kep}.js"
_compile $file $out_node "--package_manager=node"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment