瀏覽代碼

Add support for rebar3

Allow Jiffy to be used easily in projects using either rebar 2 or 3.
pull/118/head
Paul J. Davis 9 年之前
父節點
當前提交
c7756dae9f
共有 6 個文件被更改,包括 25 次插入10 次删除
  1. +5
    -0
      .gitignore
  2. 二進制
      enc
  3. +3
    -8
      rebar.config
  4. +2
    -1
      test/jiffy_01_yajl_tests.erl
  5. +2
    -1
      test/jiffy_10_short_double_tests.erl
  6. +13
    -0
      test/jiffy_util.hrl

+ 5
- 0
.gitignore 查看文件

@ -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

二進制
enc 查看文件


+ 3
- 8
rebar.config 查看文件

@ -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"}]}.

+ 2
- 1
test/jiffy_01_yajl_tests.erl 查看文件

@ -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).

+ 2
- 1
test/jiffy_10_short_double_tests.erl 查看文件

@ -8,7 +8,8 @@
-include("jiffy_util.hrl").
filename() -> "../test/cases/short-doubles.txt".
filename() ->
cases_path("short-doubles.txt").
short_double_test_() ->

+ 13
- 0
test/jiffy_util.hrl 查看文件

@ -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]).

Loading…
取消
儲存