summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2014-06-14 21:55:44 -0500
committerTristan Sloughter <tristan.sloughter@gmail.com>2014-06-14 21:55:44 -0500
commit29a16cbabec586e836b197ad58b38fbb184796a5 (patch)
treef01ce35167c030ae32a3c5253fc0dcaf75f51509 /src
parent1e2af5fa5141598f718a5000494aa02f7ad3aca0 (diff)
parent51584caa3e2fc6012a3ce4229751704067cae254 (diff)
Merge pull request #195 from fgallaire/switch_template_instructions
Switch template instructions
Diffstat (limited to 'src')
-rw-r--r--src/rebar_templater.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index fef4627..4abf404 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -397,6 +397,18 @@ execute_template(Files, [{'if', Cond, True, False} | Rest], TemplateType,
execute_template(Files, prepend_instructions(Instructions, Rest),
TemplateType, TemplateName, Context, Force,
ExistingFiles);
+execute_template(Files, [{'case', Variable, Values, Instructions} | Rest], TemplateType,
+ TemplateName, Context, Force, ExistingFiles) ->
+ {ok, Value} = dict:find(Variable, Context),
+ Instructions2 = case lists:member(Value, Values) of
+ true ->
+ Instructions;
+ _ ->
+ []
+ end,
+ execute_template(Files, prepend_instructions(Instructions2, Rest),
+ TemplateType, TemplateName, Context, Force,
+ ExistingFiles);
execute_template(Files, [{template, Input, Output} | Rest], TemplateType,
TemplateName, Context, Force, ExistingFiles) ->
InputName = filename:join(filename:dirname(TemplateName), Input),