Bug 6714 - Refactor generator.py to allow better wrapping 

This wasn't as easy as I'd hoped, design-wise, because of the heavy dependencies between all the different objects (console, config); and there seems to be further room for cleanup (like with the context dict); but overall, I'm pretty happy with it.

This allows a user to call main() to get the KeyboardInterrupt handling (was in ``__main__`` before), to call execGenerator() to get the full CLI implementation (with an in-memory config if needed), or he can use a custom CLI parser, setup the config and console object himself, and call runJobs().