summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Gallaire <fgallaire@gmail.com>2013-12-05 05:56:24 +0100
committerFlorent Gallaire <fgallaire@gmail.com>2013-12-11 14:10:21 +0100
commit0e39dc4149e2876649560f43730a34cccda9493c (patch)
treed99c91744909449284e885bae06a0b86719e1baf /src
parentad1da88a07a207bf6974d0fca7db4c5ac3bb51d0 (diff)
Support switch template instructions
Diffstat (limited to 'src')
-rw-r--r--src/rebar_templater.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index b8f7087..bca817f 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -385,6 +385,17 @@ 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, Value, Instructions} | Rest], TemplateType,
+ TemplateName, Context, Force, ExistingFiles) ->
+ Instructions2 = case dict:find(Variable, Context) of
+ {ok, Value} ->
+ 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),