-
Notifications
You must be signed in to change notification settings - Fork 1
/
oJobHBS.yaml
38 lines (33 loc) · 1.55 KB
/
oJobHBS.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Template oJob functionality
# Copyright 2023 Nuno Aguiar
jobs:
- name: oJob HBS Add helpers
exec: |
ow.loadTemplate();
ow.template.addFormatHelpers();
ow.template.addConditionalHelpers();
ow.template.addHelper("debug", (s) => { sprint(s); });
ow.template.addHelper("stringify", (s) => { return stringify(s); });
ow.template.addHelper("stringifyInLine", (s) => { return stringify(s, void 0, ""); });
ow.template.addHelper("toYAML", (s) => { return af.toYAML(s); });
ow.template.addHelper("env", (s) => { return getEnv(s); });
ow.template.addHelper("escape", (s) => { return s.replace(/['"]/g, "\\$1"); });
# oJob HBS file
#
- name: oJob HBS file
help: >
This job will apply an args.template hbs file using args.data to produce a new
file (args.target).
exec: >
if(isUnDef(args.template)) throw "Need to define a args.template filename to use";
if(isUnDef(args.target)) throw "Need to define a args.target filename to write the output to";
io.writeFileString(args.target, ow.loadTemplate().parseHBS(args.template, args.data));
if (isUnDef(args.quiet) || !args.quiet) log("Wrote '" + args.target + "'' based on '" + args.template + "'");
# oJob HBS
#
- name: oJob HBS
help: >
This job will apply an args.template hbs file using args.data to produce contents to args.output.
exec: >
if(isUnDef(args.template)) throw "Need to define a args.template filename to use";
args.output = ow.loadTemplate().parseHBS(args.template, args.data);