Comment #1 on issue 50 by
wer...@beroux.com: Watch to auto-build
http://code.google.com/p/fabricate/issues/detail?id=50
[Watchdog](
https://github.com/gorakhargosh/watchdog) seems to help a lot on
that.
Here is a script which does that so it should be easy to incorporate it in
fabricate:
import sys
import time
from watchdog.observers import Observer
from watchdog.tricks import ShellCommandTrick
if __name__ == __main__:
event_handler = ShellCommandTrick(shell_command='python build.py',
wait_for_process=True)
observer = Observer()
observer.schedule(event_handler, '.', recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
It has a possible issue, when you touch a file it'll be recorded as a
CREATE followed right after by a MODIFY event. There should probably be a
buffer of a few milliseconds. Possibly the files could be filtered to
include only some of them but that's more optional for now.