Skip to content

Instantly share code, notes, and snippets.

@bds
Created September 1, 2018 19:31
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 bds/0b52c141441c99d4fc4d8354284dd248 to your computer and use it in GitHub Desktop.
Save bds/0b52c141441c99d4fc4d8354284dd248 to your computer and use it in GitHub Desktop.
Use inotify modify events to compile Crystal Lang
#! /usr/bin/env sh
#
# https://github.com/rvoicilas/inotify-tools/wiki#inotifywait
#
CURPATH=`pwd`
inotifywait -mr \
--exclude "[^c][^r]$" \
--timefmt '%d/%m/%y %H:%M:%S' --format '%T %w %f' \
-e modify /usr/src/app/my-app/src | while read date time dir file; do
FILECHANGE=${dir}${file}
FILECHANGEREL=`echo "$FILECHANGE" | sed 's_'$CURPATH'/__'`
echo $time $FILECHANGEREL
crystal build --no-codegen $FILECHANGEREL
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment