sebastian-software/jasy — pull request #10 by fastner (2014-01-03 09:08:58+00:00)
Title: Generic hook plug in system

This feature adds a generic hook system to plug in jasylibrary code to specific points in code.
With this pull request two plugin points are defined:

- Generic project resolving
If you want to add file detection to Projects, you can use this hook. In my case I want to scan every project for template files. So I add a detection for path "source/template/*.html". This is done the same way e.g. styles or classes are detected. These detected files can be accessed via project.getHookContents(name).

- Plug in to resolver in compile step
This is neccessary to add virtual classes to project resolver as the resolver is not accessible outside of OutputManager. This hook is done the same way assets and translations are included.

As an easy way to define hooks the execution context of jasylibrary has a hook annotation function. So if you want to add a hook callback you can define it with

@hook("specific hook name")
def myHookCallback(param1, param2):
pass

Caching is at this time not part of the hook system.

This pull request is as always a proposal and can be discussed, but I found no other way to do it "out of the box" ;)