Skip to content

Instantly share code, notes, and snippets.

@luiscronicl
Last active December 11, 2015 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luiscronicl/4634724 to your computer and use it in GitHub Desktop.
Save luiscronicl/4634724 to your computer and use it in GitHub Desktop.
Very simple script for do automatic code deploys every time one client.js file generated with toaster is updated
#!/bin/sh
########################################################################################################
### Launches toaster compiler and copies some code to another place every time "client.js" file ###
### (this file is auto-generated with toaster) changes. ###
### requires inotify tools: sudo apt-get install inotify-tools ###
### Font (http://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes) ###
########################################################################################################
toaster -wcd &
deploy ()
{
printf "Deploying client JS core ..." -n
cp ./client.js /destiny/client.js
printf " OK\n"
printf "Deploying templates ..." -n
if [ -d /destiny/templates ]; then
rm /destiny/templates -r
fi
printf "." -n
mkdir /destiny/templates
cp ./templates /destiny/templates/ -r
printf " OK\n"
}
while inotifywait -e close_write client.js; do deploy; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment