Skip to content

Commit

Permalink
[Close #68] replace erlang.mk by rebar3
Browse files Browse the repository at this point in the history
  • Loading branch information
Euen committed Aug 11, 2016
1 parent 3c9c96f commit 19efa24
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ rel/example_project
.erlang.mk
log
logs
doc
_build
114 changes: 100 additions & 14 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,100 @@
{deps,
[
{jiffy, "0.14.7"},
{trails, ".*", {git, "https://github.com/inaka/cowboy-trails.git", {ref, "bc92848"}}}
]
}.
{xref_warnings, true}.
{xref_checks,
[ undefined_function_calls
, locals_not_used
, deprecated_function_calls
, deprecated_functions
]
}.
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et

%% == Erlang Compiler ==

%% Erlang compiler options
{erl_opts, [ warn_unused_vars
, warn_export_all
, warn_shadow_vars
, warn_unused_import
, warn_unused_function
, warn_bif_clash
, warn_unused_record
, warn_deprecated_function
, warn_obsolete_guard
, strict_validation
, warn_export_vars
, warn_exported_vars
, warn_missing_spec
, warn_untyped_record
, debug_info]}.

{profiles, [
{test, [
{deps, [ {katana_test, "0.1.1"}
, {mixer, {git, "https://github.com/inaka/mixer.git", {tag, "0.1.5"}}}
, {shotgun, "0.2.3"}
]}
]},
{shell, [
{deps, [
{sync, {git, "https://github.com/rustyio/sync.git", {ref, "9c78e7b"}}}
]}
]}
]}.

%% == Common Test ==

{ct_compile_opts, [ warn_unused_vars
, warn_export_all
, warn_shadow_vars
, warn_unused_import
, warn_unused_function
, warn_bif_clash
, warn_unused_record
, warn_deprecated_function
, warn_obsolete_guard
, strict_validation
, warn_export_vars
, warn_exported_vars
, warn_missing_spec
, warn_untyped_record
, debug_info]}.

{ct_opts, [ {sys_config, ["./test/test.config"]}
, {verbose, true}]}.

%% == Cover ==

{cover_enabled, true}.

{cover_opts, [verbose]}.

%% == Dependencies ==

{deps, [ {jiffy, "0.14.7"}
, {trails, "0.2.0"}
]}.

%% == Dialyzer ==

{dialyzer, [ {warnings, [ no_return
, unmatched_returns
, error_handling
]}
, {plt_apps, top_level_deps}
, {plt_extra_apps, []}
, {plt_location, local}
, {base_plt_apps, [stdlib, kernel]}
, {base_plt_location, global}]}.

{overrides,
[{override, jiffy, [
{plugins, [pc]},
{artifacts, ["priv/jiffy.so"]},
{provider_hooks, [
{post,
[
{compile, {pc, compile}},
{clean, {pc, clean}}
]
}]
}
]}
]}.


%% == Shell ==

{shell, [{apps, [sync]}]}.
5 changes: 5 additions & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[{<<"cowboy">>,{pkg,<<"cowboy">>,<<"1.0.4">>},1},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"1.0.2">>},2},
{<<"jiffy">>,{pkg,<<"jiffy">>,<<"0.14.7">>},0},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.2.1">>},1},
{<<"trails">>,{pkg,<<"trails">>,<<"0.2.0">>},0}].
2 changes: 1 addition & 1 deletion src/cowboy_swagger.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
{"Blog", "http://inaka.net/blog/2015/08/19/cowboy-swagger/"},
{"Example", "https://github.com/inaka/cowboy-swagger/tree/master/example"}
]},
{build_tools,["erlang.mk", "rebar"]}
{build_tools,["rebar3"]}
]
}.
2 changes: 2 additions & 0 deletions src/cowboy_swagger_json_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ content_types_provided(Req, State) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% @hidden
-spec handle_get(cowboy_req:req(), state()) ->
{iodata(), cowboy_req:req(), state()}.
handle_get(Req, State) ->
Server = maps:get(server, State, '_'),
HostMatch = maps:get(host, State, '_'),
Expand Down
3 changes: 2 additions & 1 deletion test/cowboy_swagger_handler_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ handler_test(_Config) ->
ct:comment("GET /api-docs/swagger-ui-js should return 200 OK"),
#{status_code := 200, body := SwaggerUIBody} =
cowboy_swagger_test_utils:api_call(get, "/api-docs/swagger-ui.js"),
{ok, SwaggerUIBodySrc} = file:read_file("../../priv/swagger/swagger-ui.js"),
{ok, SwaggerUIBodySrc} =
file:read_file("../../../../priv/swagger/swagger-ui.js"),
SwaggerUIBody = SwaggerUIBodySrc,

%% GET unknown-file.ext - test /api-docs/[...] trail
Expand Down
2 changes: 1 addition & 1 deletion test/cowboy_swagger_meta_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

-spec init_per_suite(config()) -> config().
init_per_suite(Config) ->
[ {base_dir, "../.."} | Config].
[ {application, cowboy_swagger} | Config].

0 comments on commit 19efa24

Please sign in to comment.