mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Setup code path prior to calling edoc
Setup code path prior to calling edoc so that edown, asciiedoc, and the like can work properly when generating their own documentation.
This commit is contained in:
parent
86325b616d
commit
4a5114b79f
1 changed files with 19 additions and 0 deletions
|
@ -48,7 +48,26 @@
|
||||||
%% @doc Generate Erlang program documentation.
|
%% @doc Generate Erlang program documentation.
|
||||||
-spec doc(Config::rebar_config:config(), File::file:filename()) -> ok.
|
-spec doc(Config::rebar_config:config(), File::file:filename()) -> ok.
|
||||||
doc(Config, File) ->
|
doc(Config, File) ->
|
||||||
|
%% Save code path
|
||||||
|
CodePath = setup_code_path(),
|
||||||
{ok, AppName, _AppData} = rebar_app_utils:load_app_file(File),
|
{ok, AppName, _AppData} = rebar_app_utils:load_app_file(File),
|
||||||
EDocOpts = rebar_config:get(Config, edoc_opts, []),
|
EDocOpts = rebar_config:get(Config, edoc_opts, []),
|
||||||
ok = edoc:application(AppName, ".", EDocOpts),
|
ok = edoc:application(AppName, ".", EDocOpts),
|
||||||
|
%% Restore code path
|
||||||
|
true = code:set_path(CodePath),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
%% ===================================================================
|
||||||
|
%% Internal functions
|
||||||
|
%% ===================================================================
|
||||||
|
|
||||||
|
setup_code_path() ->
|
||||||
|
%% Setup code path prior to calling edoc so that edown, asciiedoc,
|
||||||
|
%% and the like can work properly when generating their own
|
||||||
|
%% documentation.
|
||||||
|
CodePath = code:get_path(),
|
||||||
|
true = code:add_patha(ebin_dir()),
|
||||||
|
CodePath.
|
||||||
|
|
||||||
|
ebin_dir() ->
|
||||||
|
filename:join(rebar_utils:get_cwd(), "ebin").
|
||||||
|
|
Loading…
Reference in a new issue