Ir al contenido principal

Hi, I'm Mariano Guerra, below is my blog, if you want to learn more about me and what I do check a summary here: marianoguerra.github.io or find me on twitter @warianoguerra or Mastodon @marianoguerra@hachyderm.io

[EN] CouchApp III: pushing the changes automatically

now we have all we need to start creating our couchapp, go to the _attachments directory and start modifying the code to do what you want


after a moment you will notice that you need to push the changes to couchdb each time you want to test it, if you are like me this will get annoying pretty fast, let's make the tools help us


#install inotify-tools
sudo apt-get install inotify-tools

with inotify tools we will run a script that will monitor any file change and make a couchapp push when that happens, I will exclude the changes in *.swp files since vim create those and they change pretty often


in some shell run this and leave it running


inotifywait -q -e modify -m -r . | while read line; do if echo $line | grep -v .*.swp; then couchapp push; fi; done

now edit some file and save it, go back to the shell where the script is running, you should see something like:


./_attachments/ MODIFY index.html
2010-10-22 11:00:48 [INFO] Visit your CouchApp here:
http://wariano:secret@localhost:5984/datos/_design/datos/index.html

now you can edit your files and the changes will be pushed automatically to couchdb