From 60629e85162110e750b986a1531ce0594e75bd3f Mon Sep 17 00:00:00 2001 From: Bryan Fink Date: Thu, 4 Feb 2010 17:45:05 -0500 Subject: add chmod template directive for changing file file permission usage: {chmod, Mode, File} where: Mode is an integer, as specified by the 'mode' field of the file_info record (see docs for file:write_file_info/2) --- src/rebar_templater.erl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index 7a21e7d..9e2971c 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -254,6 +254,14 @@ execute_template([{dir, Name} | Rest], TemplateType, TemplateName, Context, Forc ?ABORT("Failed while processing template instruction {dir, ~s}: ~p\n", [Name, Reason]) end; +execute_template([{chmod, Mod, File} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) when is_integer(Mod) -> + case file:change_mode(File, Mod) of + ok -> + execute_template(Rest, TemplateType, TemplateName, Context, Force, ExistingFiles); + {error, Reason} -> + ?ABORT("Failed while processing template instruction {cmod, ~b, ~s}: ~p~n", + [Mod, File, Reason]) + end; execute_template([{variables, _} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) -> execute_template(Rest, TemplateType, TemplateName, Context, Force, ExistingFiles); execute_template([{file, Input, Output} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) -> -- cgit v1.1