Skip to content

Commit

Permalink
Added simple plug-in for rebar to export EUnit coverage data
Browse files Browse the repository at this point in the history
  • Loading branch information
idubrov committed Sep 11, 2011
1 parent 42a4016 commit 6e15609
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deps/
ebin/
1 change: 0 additions & 1 deletion covertool
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ generate_class(Module) ->
{ok, Lines} = cover:analyse(Module, calls, line),
{LinesData, Result} = lists:mapfoldl(Fun, #result{}, Lines),

% [{Line,{Cov,NotCov}}]
Data = {class, [{name, Module},
{filename, lookup_source(Module)},
{'line-rate', rate(Result#result.line)},
Expand Down
5 changes: 5 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{deps_dir, ["deps"]}.
{deps,
[
{rebar, ".*", {git, "https://github.com/basho/rebar.git"}}
]}.
11 changes: 11 additions & 0 deletions src/covertool.app.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{application, covertool,
[
{description, "Covertool Build Plugin"},
{vsn, "1"},
{registered, []},
{applications, [
kernel,
stdlib
]},
{env, []}
]}.
14 changes: 14 additions & 0 deletions src/rebar_covertool.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-module(rebar_covertool).
-include_lib("rebar/include/rebar.hrl").

%% Application callbacks
-export([eunit/2]).

eunit(Config, _X) ->
Export = rebar_config:get_local(Config, cover_export, undefined),
case Export of
undefined -> ok;
File ->
?CONSOLE("Exporting cover data to '~p'~n", [File]),
cover:export(File)
end.

0 comments on commit 6e15609

Please sign in to comment.