alexpearce/root-web-monitoring — pull request #6 by alexpearce (2014-07-07 16:08:16+00:00)
Title: Modularisation

Yet another major refactor!

This is long overdue. The problem with the `master` branch today is that it provides examples in such a way that the only logical thing for a developer of a derivative application to do is just clone the code, then edit for their own use. This is bad as the derivative app will quickly move away from this repository, and merging changes will be close to impossible.

This refactor creates a `webmonitor` module which derivative applications can simply `import`, and then provide their own templates, static files, job tasks, etc. The simplest case for a derivative app is now a single file.

```python
import webmonitor

app = webmonitor.create_app()
app.run()
```

A [full example application](https://github.com/alexpearce/example-monitoring-app) is now available and will be developed in tandem with this repository, showing off features as necessary.

This extraction-abstraction is nice for a few reasons.

* Developers can get a clear idea of how their derivative applications can/will be structued
* An update to this central `webmonitor` module can be picked up by derivative apps with `pip install --upgrade` (if lots of derivatives are implementing the same feature, we can implement centrally, for example)
* Testing is considerably more modular, and tests for this `webmonitor` module (coming soon!) have a much smaller scope
* Having had the chance to refactor the core, there is now a clean jobs API on the server and in the `WebMonitor` JavaScript object

In time, the `Vagrantfile` and provisioning scripts will be moved out of this repo and in to the example application's, as they aren't relevant here.