summaryrefslogtreecommitdiff
path: root/generate_app
blob: 576b485e1ef6aafa135c9becdd5a9be952ea9313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env escript
%% -*- erlang -*-

main([BeamDir, TargetFile]) ->
    Modules = [list_to_atom(filename:basename(F, ".beam")) ||
                  F <- filelib:wildcard("*.beam", BeamDir)],
    {ok, {application, Application, Properties}} = io:read(''),
    NewProperties = lists:keyreplace(modules, 1, Properties,
                                     {modules, Modules}),
    file:write_file(
      TargetFile,
      io_lib:format("~p.~n", [{application, Application, NewProperties}])).