25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Show messages with next configuration steps when installing a module

This commit is contained in:
Badlop 2021-07-01 13:17:00 +02:00
parent 331a67f5f8
commit bb0c6e1e02

View File

@ -638,6 +638,7 @@ install(Module, Spec, SrcDir, LibDir) ->
Errors = lists:dropwhile(fun({_, ok}) -> true; Errors = lists:dropwhile(fun({_, ok}) -> true;
(_) -> false (_) -> false
end, Files1++Files2), end, Files1++Files2),
inform_module_configuration(Module, LibDir, Files1),
Result = case Errors of Result = case Errors of
[{F, {error, E}}|_] -> [{F, {error, E}}|_] ->
{error, {F, E}}; {error, {F, E}};
@ -649,6 +650,24 @@ install(Module, Spec, SrcDir, LibDir) ->
file:set_cwd(CurDir), file:set_cwd(CurDir),
Result. Result.
inform_module_configuration(Module, LibDir, Files1) ->
Res = lists:filter(fun({[$c, $o, $n, $f |_], ok}) -> true;
(_) -> false
end, Files1),
case Res of
[{ConfigPath, ok}] ->
FullConfigPath = filename:join(LibDir, ConfigPath),
io:format("Module ~p has been installed and started.~n"
"It's configured in the file:~n ~s~n"
"Configure the module in that file, or remove it~n"
"and configure in your main ejabberd.yml~n",
[Module, FullConfigPath]);
[] ->
io:format("Module ~p has been installed.~n"
"Now you can configure it in your ejabberd.yml~n",
[Module])
end.
%% -- minimalist rebar spec parser, only support git %% -- minimalist rebar spec parser, only support git
fetch_rebar_deps(SrcDir) -> fetch_rebar_deps(SrcDir) ->