Skip to content

Instantly share code, notes, and snippets.

@italomaia
Created November 18, 2018 19:28
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 italomaia/3fcdb33e1982d4987e6ff1af7b6dc149 to your computer and use it in GitHub Desktop.
Save italomaia/3fcdb33e1982d4987e6ff1af7b6dc149 to your computer and use it in GitHub Desktop.
If you're developing with lapis framework, this will help you keep your lua files in sync with moon files
#!/bin/sh
echo "watching moon files under $(pwd)";
inotifywait -m -r -q -e create -e close_write -e moved_from -e moved_to $(pwd) |
while read path action file; do
name="$path$file";
# ignore everything that is not a moonfile
if echo "$file" | grep -q ".moon$" ; then
if [ $action = 'MOVED_FROM' ] || [ $action = 'DELETE' ]; then
# clean up lua files
rm "$(echo $name| sed 's/.moon/.lua/')";
else
moonc $name; # =D
echo "reloading lapis";
lapis build; # reload our code
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment