Skip to content
Permalink
Browse files
Add support for rebar3
Allow Jiffy to be used easily in projects using either rebar 2 or 3.
  • Loading branch information
davisp committed Sep 29, 2016
1 parent 0789c08 commit c7756dae9f98a86d0670d5be6539ac8202a1f86a
Showing 6 changed files with 25 additions and 10 deletions.
@@ -1,10 +1,15 @@
.eunit
.rebar
.jiffy.dev
*.app
*.beam
*.d
*.o
*.so
_build
compile_commands.json
deps
erln8.config
hexer.config
rebar.lock
TEST-*.xml
BIN +22.7 KB enc
Binary file not shown.
@@ -33,13 +33,8 @@
]}.

{eunit_opts, [
verbose,
{report, {
eunit_surefire, [{dir,"."}]
}}
]}.

{plugins, [
rebar_gdb_plugin
verbose
]}.

{pre_hooks, [{"", compile, "./enc compile"}]}.
{post_hooks, [{"", clean, "./enc clean"}]}.
@@ -5,6 +5,7 @@


-include_lib("eunit/include/eunit.hrl").
-include("jiffy_util.hrl").


yajl_test_() ->
@@ -19,7 +20,7 @@ gen({Name, Json, Erl}) ->


read_cases() ->
CasesPath = filename:join(["..", "test", "cases", "*.json"]),
CasesPath = cases_path("*.json"),
FileNames = lists:sort(filelib:wildcard(CasesPath)),
lists:map(fun(F) -> make_pair(F) end, FileNames).

@@ -8,7 +8,8 @@
-include("jiffy_util.hrl").


filename() -> "../test/cases/short-doubles.txt".
filename() ->
cases_path("short-doubles.txt").


short_double_test_() ->
@@ -25,3 +25,16 @@ enc(V) ->

enc(V, Opts) ->
iolist_to_binary(jiffy:encode(V, Opts)).


%% rebar runs eunit with PWD as .eunit/
%% rebar3 runs eunit with PWD as ./
%% this adapts to the differences
cases_path(Suffix) ->
{ok, Cwd} = file:get_cwd(),
Prefix = case filename:basename(Cwd) of
".eunit" -> "..";
_ -> "."
end,
Path = "test/cases",
filename:join([Prefix, Path, Suffix]).

0 comments on commit c7756da

Please sign in to comment.