|
matthias@729
|
1 |
#!/usr/bin/env escript
|
|
matthias@729
|
2 |
%% -*- erlang -*-
|
|
matthias@729
|
3 |
|
|
matthew@7327
|
4 |
main([InFile, OutFile | SrcDirs]) ->
|
|
simon@7219
|
5 |
Modules = [list_to_atom(filename:basename(F, ".erl")) ||
|
|
simon@7221
|
6 |
SrcDir <- SrcDirs,
|
|
simon@7219
|
7 |
F <- filelib:wildcard("*.erl", SrcDir)],
|
|
matthew@7327
|
8 |
{ok, [{application, Application, Properties}]} = file:consult(InFile),
|
|
simon@7220
|
9 |
NewProperties =
|
|
simon@7220
|
10 |
case proplists:get_value(modules, Properties) of
|
|
simon@7220
|
11 |
[] -> lists:keyreplace(modules, 1, Properties, {modules, Modules});
|
|
simon@7220
|
12 |
_ -> Properties
|
|
simon@7220
|
13 |
end,
|
|
matthias@2190
|
14 |
file:write_file(
|
|
matthew@7327
|
15 |
OutFile,
|
|
matthias@2190
|
16 |
io_lib:format("~p.~n", [{application, Application, NewProperties}])).
|