refactor: Use askama crate for compile-time template type checking

This commit is contained in:
Gerald Pinder 2024-01-03 23:38:08 -05:00
parent 039c5f9659
commit d663b7574b
9 changed files with 364 additions and 778 deletions

View file

@ -0,0 +1,17 @@
{%- for module in modules %}
{%- if let Some(type) = module.module_type %}
{%- if type == "containerfile" %}
{%- if let Some(containerfiles) = self::get_containerfile_list(module) %}
{%- for c in containerfiles %}
{{ self::print_containerfile(c) }}
{%- endfor %}
{%- endif %}
{%- else %}
RUN chmod +x /tmp/modules/{{ type }}/{{ type }}.sh && source /tmp/exports.sh && /tmp/modules/{{ type }}/{{ type }}.sh '{{ self::print_module_context(module) }}'
{%- endif %}
{%- endif %}
{%- if let Some(from_file) = module.from_file %}
{{ self::get_module_from_file(from_file).render().unwrap() }}
{%- endif %}
{%- endfor %}