At work I do a lot of Java web development, which normally involves compiling code, packaging into a .war file and deploying it to Tomcat (running locally). I make use of the maven tomcat plugin, so it's just a case of calling maven tomcat:redeploy. However it still takes tens of seconds (or more if there are tests to run). For quick tweaks of css it's nice to be able to short-circuit this process.
We've been using compass lately for css and it has a handy command:
That monitors .sass files for changes, then re-compiles them to css as they change, so you can see changes quickly (without needing to manually run compass each time).
So I thought I could do something similar for the editable files within the war file. So I created watch-cp.py. It simply monitors a set of files and/or directories for changes and copies over files that have changed to a source file or directory. To provide a bit of feedback it prints out when it spots a changed file, but beyond that it's pretty brute-force in it's approach.
watch-cp.py works in a very similar way to the cp command, but without as many options. For example:
# recursively copy files from src/main/webapp to tomcat watch-cp.py -r src/main/webapp/* ~/tomcat/webapps/mywebapp
This is great as it means I can edit my sass files, have them compiled to css by compass, then copied over to tomcat without needing to intervene. It takes a second sometimes, but it's fast enough for the most part.
Feel free to fork the gist of watch-cp.py on github.