Browse Source

Make sure *both* .eunit and ebin directory exists before setting up the code path.

Normally the ebin directory doesn't contain any source files. Therefore it won't be kept in the repository by, at least, mercurial and also maybe git unless you put some .keep file in it or do some other hack. The ebin directory is created by rebar compile, but if rebar eunit is called before rebar compile, you end up with a {'EXIT', {{badmatch,{error,bad_directory}},...}. Another approach would be not to match cod:add_pathz(ebin_dir()) with ok, but I think this is an ok solution as well.
pull/3/head
Oscar Hellström 15 years ago
parent
commit
8c03d5959b
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/rebar_eunit.erl

+ 2
- 1
src/rebar_eunit.erl View File

@ -74,8 +74,9 @@ eunit(Config, AppFile) ->
end
end,
%% Make sure ?EUNIT_DIR/ directory exists (tack on dummy module)
%% Make sure ?EUNIT_DIR/ and ebin/ directory exists (tack on dummy module)
ok = filelib:ensure_dir(?EUNIT_DIR ++ "/foo"),
ok = filelib:ensure_dir(ebin_dir() ++ "/foo"),
%% Setup code path prior to compilation so that parse_transforms and the like
%% work properly. Also, be sure to add ebin_dir() to the END of the code path

Loading…
Cancel
Save