diff options
author | Joseph Wayne Norton <norton@alum.mit.edu> | 2011-10-15 22:45:26 +0900 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-10-20 16:32:05 +0200 |
commit | 4a5114b79fcb7e2a7d7b7c52c2bb5ab79d4c80fe (patch) | |
tree | 92a4afc76d18e9de481400980f33c9825e67aae7 | |
parent | 86325b616d123bab9517fa957e08f0acb1fffd93 (diff) |
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.
-rw-r--r-- | src/rebar_edoc.erl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/rebar_edoc.erl b/src/rebar_edoc.erl index ce5458a..27e0015 100644 --- a/src/rebar_edoc.erl +++ b/src/rebar_edoc.erl @@ -48,7 +48,26 @@ %% @doc Generate Erlang program documentation. -spec doc(Config::rebar_config:config(), File::file:filename()) -> ok. doc(Config, File) -> + %% Save code path + CodePath = setup_code_path(), {ok, AppName, _AppData} = rebar_app_utils:load_app_file(File), EDocOpts = rebar_config:get(Config, edoc_opts, []), ok = edoc:application(AppName, ".", EDocOpts), + %% Restore code path + true = code:set_path(CodePath), 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"). |