Mostrando las entradas con la etiqueta fiaca. Mostrar todas las entradas
Mostrando las entradas con la etiqueta fiaca. Mostrar todas las entradas

viernes, octubre 22, 2010

CouchApp III: subiendo los cambios automaticamente

ahora que tenemos todo lo que necesitamos para crear nuestra couchapp, podemos ir al directorio _attachments y empezar a modificar el código para que haga lo que queramos


después de un rato vas a notar que necesitas hacer push de los cambios a couchdb cada vez que queres probarlos, si sos como yo esto se va a poner molesto bastante rápido, hagamos que las herramientas nos ayuden


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

con inotify tools vamos a correr un script que va a monitorear cualquier cambio de archivos y va a hacer un push cuando eso suceda, voy a excluir los cambios en *.swp ya que vim crea esos archivos y cambian bastante seguido


corre este comando en algún shell y dejalo corriendo


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

ahora edita algún archivo y guardalo, anda al shell donde tenes el script corriendo, vas a ver algo como esto:


./_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

ahora podes editar tus archivos y los cambios van a ser automáticamente subidos a couchdb

[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

Seguidores

Archivo del Blog