Created
November 18, 2018 19:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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