mdsol/dice_bag

Provide template documentation to developers

Opened this issue · 4 comments

Developers will want to learn what configuration options are available. We should have a config:help task that does this. It may be as simple as dumping the templates to screen.

More complicated options might execute the template with a special configured object that records all the calls made to it, so that we can output a terse report of all the environment variables used. We might want to output the default values too but we'd have to change default handling from <%= configured.my_var || 'my default' %> to <%= configured.my_var.with_default('my default') %>.

My suggestion above to spy on usage of configured only works (naively) if the template is logic-free. We could perhaps permute all requested configuration values against nil and non-nil. Not sure I like the thought of the combinatorial explosion this might lead to.

Alternatively, perhaps we should use logic-free templates like mustache and add "view" objects for any sophisticated logic. Not sure how keen I am to add this as an extra dependency.

@asmith-mdsol Why are we taking the approach to doing custom templates of having an application build a class for this vs. use a canonical folder in the application root (e.g. lib/templates) that the existing rake task can pickup up erb templates there when you generate all, etc. Or am I misunderstanding implementing custom templates?

I think we write/read the templates in config/ because they are configuration, I would not expect them in lib/
even in config/templates I would expect something different.