Source

AutoRebuild /

AutoRebuild

AutoRebuild is a really simple CherryPy plugin that provides a hook
point that is triggered when certain files change. It is similar to
the Autoreloader plugin with the primary difference that it does not
restart the engine and instead calls a function.

AutoRebuild also provides a ServiceStarter plugin that will start a
service for you. As this tool was originally written to support things
like sass and less where you want CSS changes to be reflected
immediately and automatically, the ServiceStarter will let you start
up something like "sass --watch".

More generally though, the ServiceStarter plugin can help you
configure extra services you might need running in development or in
testing. This avoids the necessity to use something like Foreman for
service coordination in development.

Assuming you run this in the root of your source, you can now visit
http://localhost:9000 to see the actual Python files.

History

A developer asked me if there was a good way to force CherryPy to
restart and rebuild some sass files when the files changed. Knowing
that the Autoreloader plugin already existed it seemed trivial to
implement. The immediate solution was to simply use the 'sass --watch'
command in a foreman procfile, but thinking about it, it seemed pretty
silly when you could do it in CherryPy relatively easily and avoid
having to depend on something like foreman all together.

I then realized there were tools like CodeKit people were actually
selling to do this for you and it seemed ridiculous that there wasn't
an easy way to do this in CherryPy. Fortunately, thanks to the WSPBus
in CherryPy, it was a breeze.