浏览代码

add edoc provider

pull/189/head
Tristan Sloughter 10 年前
父节点
当前提交
4eaeca8890
共有 3 个文件被更改,包括 50 次插入0 次删除
  1. +1
    -0
      README.md
  2. +1
    -0
      src/rebar.app.src
  3. +48
    -0
      src/rebar_prv_edoc.erl

+ 1
- 0
README.md 查看文件

@ -33,6 +33,7 @@ limit scope.
| ct | Run Common Test suites |
| do | Higher-order provider to run multiple tasks in sequence |
| dialyzer | Run the Dialyzer analyzer on the project |
| edoc | Generate documentation using edoc |
| eunit | Run eunit tests |
| help | Print help for rebar or task |
| new | Create new rebar project from templates |

+ 1
- 0
src/rebar.app.src 查看文件

@ -29,6 +29,7 @@
rebar_prv_dialyzer,
rebar_prv_do,
rebar_prv_eunit,
rebar_prv_edoc,
rebar_prv_lock,
rebar_prv_install_deps,
rebar_prv_packages,

+ 48
- 0
src/rebar_prv_edoc.erl 查看文件

@ -0,0 +1,48 @@
-module(rebar_prv_edoc).
-behaviour(provider).
-export([init/1,
do/1,
format_error/1]).
-include("rebar.hrl").
-define(PROVIDER, edoc).
-define(DEPS, [app_discovery]).
%% ===================================================================
%% Public API
%% ===================================================================
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER},
{module, ?MODULE},
{bare, false},
{deps, ?DEPS},
{example, "rebar edoc"},
{short_desc, "Generate documentation using edoc."},
{desc, ""},
{opts, []}])),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
ProjectApps = rebar_state:project_apps(State),
EDocOpts = rebar_state:get(State, edoc_opts, []),
lists:foreach(fun(AppInfo) ->
AppName = ec_cnv:to_list(rebar_app_info:name(AppInfo)),
?INFO("Running edoc for ~s", [AppName]),
AppDir = rebar_app_info:dir(AppInfo),
ok = edoc:application(list_to_atom(AppName), AppDir, EDocOpts)
end, ProjectApps),
{ok, State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions
%% ===================================================================

正在加载...
取消
保存