mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
Add support for {copy, src, dst} to templater
This commit is contained in:
parent
45f44c2166
commit
dd9adac8c4
1 changed files with 11 additions and 0 deletions
|
@ -359,6 +359,17 @@ execute_template([{dir, Name} | Rest], TemplateType, TemplateName, Context,
|
||||||
?ABORT("Failed while processing template instruction "
|
?ABORT("Failed while processing template instruction "
|
||||||
"{dir, ~s}: ~p\n", [Name, Reason])
|
"{dir, ~s}: ~p\n", [Name, Reason])
|
||||||
end;
|
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,
|
execute_template([{chmod, Mod, File} | Rest], TemplateType, TemplateName,
|
||||||
Context, Force, ExistingFiles) when is_integer(Mod) ->
|
Context, Force, ExistingFiles) when is_integer(Mod) ->
|
||||||
case file:change_mode(File, Mod) of
|
case file:change_mode(File, Mod) of
|
||||||
|
|
Loading…
Reference in a new issue