diff options
author | cloudhead <alexis@cloudhead.io> | 2011-07-04 18:17:44 -0400 |
---|---|---|
committer | Dave Smith <dizzyd@dizzyd.com> | 2011-07-08 11:32:23 -0600 |
commit | dd9adac8c4ca08e54ca6f2de172a57ef99ed51d9 (patch) | |
tree | a723ac6ae09a354c3107bf35fecf7cae76e1f324 /src | |
parent | 45f44c2166d2ef2ec2e05bc85c5aeb96f675a8c7 (diff) |
Add support for {copy, src, dst} to templater
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_templater.erl | 11 |
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 |