PLUS-POSTECH / soma

Cross-platform CTF problem container manager
Apache License 2.0
24 stars 3 forks source link

Refactor template handling #46

Closed Qwaz closed 5 years ago

Qwaz commented 5 years ago

Instead of using convert_to_docker_entry, use handlebars helper function. Eventually, file rendering will look similar to this. (grammar unchecked)

Rust part

// this function returns a Handlebars instance with the helper "default_path" registered
let renderer = templates::renderer_with_default_path(format!("/home/{}", repo_name));
renderer.render_templates(...)

Template part

COPY "{{ this.path }}" "{{ default_path this.target_path }}"
RUN chmod +x "{{ this.target_path }}"