jingen 0.1.0

Creator: railscoder56

Last updated:

Add to Cart

Description:

jingen 0.1.0

Jingen generates files from Jinja2 based template files.

Usage:
Assuming a vars file mock_vars.py
VARS = {
"test_var": "vars_file_test_value"
}
and a template file: mock.template:
I'M A MOCK TEMPLATE AND MY VAR IS: {{ test_var }}
from jingen.jingen import Jingen

template_file = "mock.template"
vars_source = "tests/resources/mock_vars.py" # alternatively, can be a dict
output_file = "tests/resources/manual_test_result.file"
templates_dir = "tests/resources/"
make_file = True
verbose = True

i = Jingen(
template_file=template_file,
vars_source=vars_source,
output_file=output_file,
templates_dir=templates_dir,
make_file=make_file,
verbose=verbose)
output = i.generate()

print output
...
I'M A MOCK TEMPLATE AND MY VAR IS: vars_file_test_value
Output would be:
### DEBUG - generating template from tests/resources//mock.template
### DEBUG - creating file: tests/resources/manual_test_result.file with content:
I'M A MOCK TEMPLATE AND MY VAR IS: vars_file_test_value

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.