Merge pull request #69 from maxlapshin/master

I've added variable expansion in replace overlay
This commit is contained in:
Dave Smith 2011-05-20 08:23:19 -07:00
commit ea8aca4519

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 ->