Expand variables in replace overlay

This commit is contained in:
Max Lapshin 2011-04-29 14:58:31 +04:00
parent f51e3df3b9
commit 8666d57d78

View file

@ -341,7 +341,7 @@ execute_overlay([{replace, Out, Regex, Replacement, Opts} | Rest],
Vars, BaseDir, TargetDir) -> Vars, BaseDir, TargetDir) ->
Filename = rebar_templater:render(filename:join(TargetDir, Out), Vars), Filename = rebar_templater:render(filename:join(TargetDir, Out), Vars),
{ok, OrigData} = file:read_file(Filename), {ok, OrigData} = file:read_file(Filename),
Data = re:replace(OrigData, Regex, Replacement, Data = re:replace(OrigData, Regex, rebar_templater:render(Replacement, Vars),
[global, {return, binary}] ++ Opts), [global, {return, binary}] ++ Opts),
case file:write_file(Filename, Data) of case file:write_file(Filename, Data) of
ok -> ok ->