summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcloudhead <alexis@cloudhead.io>2011-07-04 18:17:44 -0400
committerDave Smith <dizzyd@dizzyd.com>2011-07-08 11:32:23 -0600
commitdd9adac8c4ca08e54ca6f2de172a57ef99ed51d9 (patch)
treea723ac6ae09a354c3107bf35fecf7cae76e1f324 /src
parent45f44c2166d2ef2ec2e05bc85c5aeb96f675a8c7 (diff)
Add support for {copy, src, dst} to templater
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 76fa4d4..0bda300 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -359,6 +359,17 @@ execute_template([{dir, Name} | Rest], TemplateType, TemplateName, Context,
?ABORT("Failed while processing template instruction "
"{dir, ~s}: ~p\n", [Name, Reason])
end;
+execute_template([{copy, Input, Output} | Rest], TemplateType, TemplateName,
+ Context, Force, ExistingFiles) ->
+ InputName = filename:join(filename:dirname(TemplateName), Input),
+ case rebar_file_utils:cp_r([InputName ++ "/*"], Output) of
+ ok ->
+ execute_template(Rest, TemplateType, TemplateName,
+ Context, Force, ExistingFiles);
+ {error, Reason} ->
+ ?ABORT("Failed while processing template instruction "
+ "{dir, ~s, ~s}: ~p\n", [Input, Output, Reason])
+ end;
execute_template([{chmod, Mod, File} | Rest], TemplateType, TemplateName,
Context, Force, ExistingFiles) when is_integer(Mod) ->
case file:change_mode(File, Mod) of