Factor out RenderTemplateCFEngine, RenderTemplateMustache
Only commit mustache template to disk if rendering is successful

Use Buffer instead of Writer for MustacheRender. Redmine #5292