rebar.config.script 710 B

123456789101112131415161718
  1. %%-*- mode: erlang -*-
  2. %% load the helper modules:
  3. CompileOpts = [verbose,report_errors,report_warnings,return_errors,binary],
  4. [case compile:file(ModFile, CompileOpts) of
  5. {ok, Mod, BinCode} ->
  6. {module, _} = code:load_binary(Mod, ModFile, BinCode);
  7. Error ->
  8. io:format("[error] compile:file(~p) failed: ~p~n", [ModFile, Error])
  9. end || ModFile <- filelib:wildcard("**/mods/mod_*.erl")],
  10. %% TODO: load the plugins here:
  11. %% get user plugins from a text file, fetch it and compile
  12. %% render the rebar.config by evaluating the placeholders:
  13. CONFIG_R = mod_config_template:render(CONFIG),
  14. %file:write_file("rebar.config.rendered", [io_lib:format("~p.\n", [I]) || I <- CONFIG_R]),
  15. CONFIG_R.