mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Fix spec file look up
When trying to skip spec files under deps/ directory, ignore "deps" component which is also included in Cwd. For example, "/home/deps/src/myapp/test/cover.spec" contains "deps" component but should not be skipped if Cwd is "/home/deps/src/myapp/".
This commit is contained in:
parent
7fd5a2d630
commit
9713dafcb5
1 changed files with 17 additions and 11 deletions
|
@ -288,18 +288,24 @@ get_cover_config(Config, Cwd) ->
|
|||
end.
|
||||
|
||||
collect_glob(Cwd, Glob) ->
|
||||
filelib:fold_files(Cwd, Glob, true, fun collect_files/2, []).
|
||||
|
||||
collect_files(F, Acc) ->
|
||||
CwdParts = filename:split(Cwd),
|
||||
filelib:fold_files(Cwd, Glob, true, fun(F, Acc) ->
|
||||
%% Ignore any specs under the deps/ directory. Do this pulling
|
||||
%% the dirname off the the F and then splitting it into a list.
|
||||
Parts = filename:split(filename:dirname(F)),
|
||||
case lists:member("deps", Parts) of
|
||||
Parts2 = remove_common_prefix(Parts, CwdParts),
|
||||
case lists:member("deps", Parts2) of
|
||||
true ->
|
||||
Acc; % There is a directory named "deps" in path
|
||||
false ->
|
||||
[F | Acc] % No "deps" directory in path
|
||||
end.
|
||||
end
|
||||
end, []).
|
||||
|
||||
remove_common_prefix([H1|T1], [H1|T2]) ->
|
||||
remove_common_prefix(T1, T2);
|
||||
remove_common_prefix(L1, _) ->
|
||||
L1.
|
||||
|
||||
get_ct_config_file(TestDir) ->
|
||||
Config = filename:join(TestDir, "test.config"),
|
||||
|
|
Loading…
Reference in a new issue