Generate
Last updated
Last updated
The Generate Extension includes the controller, and provides a mechanism for generating common content from template directories. An example use case would be the ability for application developers to easily generate new plugins for their application… similar in other applications such as Chef Software’s chef generate cookbook
type utilities.
The use this extension to generate projects, plugins, extensions, scripts, etc for developers building their applications on the framework.
Documentation References:
API References:
pyYaml
A valid must be defined at the application level via such as jinja2
, mustache
, etc.
Applications using Cement <3.0.8 should continue to include pyYaml
in their dependencies.
This extension honors the following settings under the primary namespace (ex: [myapp]
) of the application configuration:
Setting
Description
template_dir
Directory path of a local template directory.
Option
Description
template_handler
A template handler to use as the backend for templating
template_dirs
A list of data directories to look for templates
template_module
A python module to look for templates
The Generate Extension looks for a generate
sub-directory in all defined template directory paths defined at the application level. If it finds a generate
directory it treats all items within that directory as a generate template.
A Generate Template requires a single configuration YAML file called .generate.yml
that looks something like:
Generate Template Configuration
The following configurations are supported in a generate template’s config:
ignore
A list of regular expressions to match files that you want to completely ignore
exclude
A list of regular expressions to match files that you want to copy only (not rendered as template)
variables
A list of variable definitions that support the following sub-keys:
This extension honors the following options: