Skip to content

Commit

Permalink
[Close #9] move from erlang.mk to rebar3
Browse files Browse the repository at this point in the history
  • Loading branch information
Euen committed Sep 9, 2016
1 parent ab9c180 commit bce5432
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 113 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Within the console:

% from here you can start using sumo

> sumo:find_all(sumo_test_people_mysql).
> sumo:find_all(people).
[]
```

Expand Down
67 changes: 14 additions & 53 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,10 @@

%% == Dependencies ==

{deps, [
{sumo_db, "0.6.1"},
{riakc, "2.4.1"},
{iso8601, "1.1.2", {pkg, inaka_iso8601}}
]}.

%% == Overrides ==

{overrides, [
{override, rebar3_protobuffs_plugin, [
{deps, [
{protobuffs, {git, "https://github.com/basho/erlang_protobuffs.git", {tag, "0.9.0"}}
}]
}]},
{override, riak_pb, [
{plugins, [
{riak_pb_msgcodegen, {git, "https://github.com/tsloughter/riak_pb_msgcodegen.git", {ref, "dc51e30"}}},
{rebar3_protobuffs_plugin, {git, "https://github.com/cmkarlsson/rebar3_protobuffs_plugin.git", {tag, "0.1.1"}}}
]},
{provider_hooks, [
{pre, [
{compile, {protobuffs, compile}},
{compile, riak_pb_msgcodegen}
]}
]}
]}
]}.
{deps, [ {lager, "3.2.1"}
, {sumo_db, "0.6.1"}
, {emysql, "0.4.4", {pkg, inaka_emysql}}
]}.

%% == Profiles ==

Expand Down Expand Up @@ -95,34 +72,18 @@

{cover_opts, [verbose]}.

%% == EDoc ==

{edoc_opts, [
{report_missing_types, true},
{source_path, ["src"]},
{report_missing_types, true},
{todo, true},
{packages, false},
{subpackages, false}
]}.

%% == Dialyzer ==

{dialyzer, [
{warnings, [
race_conditions,
no_return,
unmatched_returns,
error_handling
]},
{plt_apps, top_level_deps},
{plt_extra_apps, []},
{plt_location, local},
{plt_prefix, "sumo_db_riak"},
{base_plt_location, "."},
{base_plt_prefix, "sumo_db_riak"}
]}.
{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}]}.

%% == Shell ==

{shell, [{apps, [sumo_db_riak, sumo_db]}]}.
{shell, [{apps, [sumo_db_mysql]}]}.
54 changes: 18 additions & 36 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
[{<<"emysql">>,
{git,"https://github.com/inaka/Emysql.git",
{ref,"3ba6e876381525223b557eb6490d0f5dc664b3b8"}},
0},
{<<"eper">>,
{git,"git://github.com/mhald/eper.git",
{ref,"1db9122c043a4d70312c58c908f01f52068ce03e"}},
2},
{<<"goldrush">>,
{git,"git://github.com/DeadZen/goldrush.git",
{ref,"64864ba7fcf40988361340e48680b49a2c2938cf"}},
1},
{<<"lager">>,
{git,"https://github.com/basho/lager.git",
{ref,"cbf6679c6a693772fd1629c9cdc093e4c6c4ebf8"}},
0},
{<<"mixer">>,
{git,"https://github.com/inaka/mixer",
{ref,"086a537f33ac6d927eaf68ee6aa6250b1d246baf"}},
1},
{<<"quickrand">>,
{git,"https://github.com/okeuday/quickrand.git",
{ref,"49aa03828233b2fec398ea4244a568aeac827dd8"}},
2},
{<<"sumo_db">>,
{git,"https://github.com/inaka/sumo_db.git",
{ref,"e99d05e48d50a9785f822482596ee7a77c7cbdfd"}},
0},
{<<"uuid">>,
{git,"https://github.com/okeuday/uuid.git",
{ref,"6bc38507460c821321d66504d3f8d6c1cdb57d98"}},
1},
{<<"worker_pool">>,
{git,"https://github.com/inaka/worker_pool.git",
{ref,"5789bde4a95122edd1079dd0fe8fccf6dbeb92e1"}},
1}].
{"1.1.0",
[{<<"emysql">>,{pkg,<<"inaka_emysql">>,<<"0.4.4">>},0},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.8">>},1},
{<<"lager">>,{pkg,<<"lager">>,<<"3.2.1">>},0},
{<<"quickrand">>,{pkg,<<"quickrand">>,<<"1.3.3">>},2},
{<<"sumo_db">>,{pkg,<<"sumo_db">>,<<"0.6.1">>},0},
{<<"uuid_erl">>,{pkg,<<"uuid_erl">>,<<"1.5.2-rc1">>},1},
{<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"2.0.1">>},1}]}.
[
{pkg_hash,[
{<<"emysql">>, <<"28831000E15ED426B10BE50F6A4141356BAD576881F02EE3FC1ACE87B3235EF8">>},
{<<"goldrush">>, <<"2024BA375CEEA47E27EA70E14D2C483B2D8610101B4E852EF7F89163CDB6E649">>},
{<<"lager">>, <<"EEF4E18B39E4195D37606D9088EA05BF1B745986CF8EC84F01D332456FE88D17">>},
{<<"quickrand">>, <<"E09F71C3F2C9D6364FE388037BB6EB652CB88816DE997D29F406C32C541A765A">>},
{<<"sumo_db">>, <<"6D7BF7FEA90D8E41DEA894379A4E945622B8BFDDBB3EEF31D79B3D0CA3084056">>},
{<<"uuid_erl">>, <<"D4022AB3F4F1A28E86EA15D4075CB0C57EC908D8AF1CA2E8AF28AA815EF93C3A">>},
{<<"worker_pool">>, <<"B90273074898FA89434317991E00884DBBAFFAB5BFD964A7586317CD16FB18D4">>}]}
].
5 changes: 4 additions & 1 deletion src/sumo_db_mysql.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
sumo_db
]},
{modules, []},
{mod, {sumo_db_mysql, []}}
{licenses, ["Apache 2.0"]},
{links, [{"Github", "https://github.com/inaka/sumo_db_mysql"}]},
{mod, {sumo_db_mysql, []}},
{build_tools, ["rebar3"]}
]}.
7 changes: 4 additions & 3 deletions test/basic_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ all() ->
-spec init_per_suite(config()) -> config().
init_per_suite(Config) ->
{ok, _} = application:ensure_all_started(sumo_db_mysql),
[{module, sumo_test_people_mysql} | Config].
[{name, people} | Config].

-spec init_per_testcase(atom(), config()) -> config().
init_per_testcase(_, Config) ->
{_, Module} = lists:keyfind(module, 1, Config),
sumo_basic_test_helper:init_store(Module),
{_, Name} = lists:keyfind(name, 1, Config),
sumo_basic_test_helper:init_store(Name),
Config.

-spec end_per_suite(config()) -> config().
Expand Down
6 changes: 3 additions & 3 deletions test/conditional_logic_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ all() ->
-spec init_per_suite(config()) -> config().
init_per_suite(Config) ->
{ok, _} = application:ensure_all_started(sumo_db_mysql),
Module = sumo_test_people_mysql,
sumo_conditionals_test_helper:init_store(Module),
[{module, Module}, {people_with_like, true} | Config].
Name = people,
sumo_conditionals_test_helper:init_store(Name),
[{name, Name}, {people_with_like, true} | Config].

-spec end_per_suite(config()) -> config().
end_per_suite(Config) ->
Expand Down
3 changes: 2 additions & 1 deletion test/config_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ end_per_suite(Config) ->
%%% Exported Tests Functions
%%%=============================================================================

-spec check_overrun_handler(config()) -> term().
check_overrun_handler(_Config) ->
sumo:call(sumo_test_people_mysql, takes_too_long, []).
sumo:call(people, takes_too_long, []).
2 changes: 1 addition & 1 deletion test/events_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ all() -> [events_manager_supervisor_running].
-spec init_per_suite(Config::config()) -> config().
init_per_suite(Config) ->
{ok, _} = application:ensure_all_started(sumo_db_mysql),
[{module, sumo_test_people_mysql} | Config].
[{name, people} | Config].

-spec end_per_suite(Config::config()) -> config().
end_per_suite(Config) ->
Expand Down
6 changes: 3 additions & 3 deletions test/find_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ all() -> [find_by_sort, find_all_sort].
-spec init_per_suite(config()) -> config().
init_per_suite(Config) ->
{ok, _} = application:ensure_all_started(sumo_db_mysql),
Module = sumo_test_people_mysql,
sumo_find_test_helper:init_store(Module),
[{module, Module} | Config].
Name = people,
sumo_find_test_helper:init_store(Name),
[{name, Name} | Config].

-spec end_per_suite(config()) -> config().
end_per_suite(Config) ->
Expand Down
23 changes: 14 additions & 9 deletions test/sumo_test_people_mysql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
new/2,
new/3,
new/4,
new/5,
new/6,
new/7,
new/8,
name/1,
last_name/1,
id/1,
from_map/1,
age/1,
address/1,
birthdate/1,
created_at/1,
height/1,
description/1,
profile_image/1
profile_image/1,
is_blocked/1,
weird_field1/1,
weird_field2/1,
weird_field3/1
]}
]).

Expand All @@ -39,15 +40,19 @@
-spec sumo_schema() -> sumo:schema().
sumo_schema() ->
Fields =
[sumo:new_field(id, integer, [id, auto_increment]),
[sumo:new_field(id, integer, [id, not_null, auto_increment]),
sumo:new_field(name, string, [{length, 255}, not_null, unique]),
sumo:new_field(last_name, string, [{length, 255}, not_null]),
sumo:new_field(age, integer),
sumo:new_field(address, string, [{length, 255}]),
sumo:new_field(birthdate, date),
sumo:new_field(created_at, datetime),
sumo:new_field(height, float),
sumo:new_field(description, text),
sumo:new_field(profile_image, binary)
sumo:new_field(description, custom, [{type, text}]),
sumo:new_field(profile_image, binary),
sumo:new_field(is_blocked, boolean),
sumo:new_field(weird_field1, custom, [{type, term}]),
sumo:new_field(weird_field2, custom, [{type, list}]),
sumo:new_field(weird_field3, custom, [{type, map}])
],
sumo:new_schema(?MODULE, Fields).
sumo:new_schema(people, Fields).
18 changes: 17 additions & 1 deletion test/sumo_test_store.erl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,23 @@
non_neg_integer(), state()) ->
sumo_store:result([sumo_internal:doc()], state()).
-spec create_schema(sumo:schema(), state()) -> sumo_store:result(state()).

-spec execute(atom() | list(), state()) -> term().
-spec execute(atom(), list(), state()) -> term().
-spec find_all(sumo:schema_name(), state()) ->
sumo_store:result([sumo_internal:doc()], state()).
-spec find_all(sumo:schema_name(),
term(),
non_neg_integer(),
non_neg_integer(),
state()) ->
sumo_store:result([sumo_internal:doc()], state()).
-spec find_by(sumo:schema_name(),
sumo:conditions(),
term(),
non_neg_integer(),
non_neg_integer(),
state()) ->
sumo_store:result([sumo_internal:doc()], state()).
init(Options) ->
sumo_store_mysql:init(Options).

Expand Down
2 changes: 1 addition & 1 deletion test/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{workers, 10}]
}]
},
{docs, [{sumo_test_people_mysql, sumo_test_mysql}]},
{docs, [{people, sumo_test_mysql, #{module => sumo_test_people_mysql}}]},
{events, [{sumo_test_people_mysql, sumo_test_people_mysql_events_manager}]}
]
},
Expand Down

0 comments on commit bce5432

Please sign in to comment.