Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic App Setup #3

Merged
merged 2 commits into from
Jun 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .awconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ebin
rel/example_project
.concrete/DEV_MODE
.rebar
_build/
33 changes: 33 additions & 0 deletions config/sys.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[
%% Sumo DB
, { sumo_db
, [ {log_queries, true}
, {query_timeout, 30000}
, {wpool_opts, [{overrun_warning, 100}]}
, {storage_backends, []}
, { stores
, [ { bc_store_mnesia
, sumo_store_mnesia
, [ {workers, 10}
, {disc_copies, here}
]
}
]
}
, { docs
, [
]
}
, { events
, [
]
}
]
}
%% SASL
, { sasl
, [ {sasl_error_logger, false}
, {errlog_type, error}
]
}
].
11 changes: 11 additions & 0 deletions config/vm.args
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Name of the node
-name olympics

## Cookie for distributed erlang
-setcookie beam

## Enable SMP
-smp enable

+K true
+A 30
32 changes: 32 additions & 0 deletions elvis.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
elvis,
[
{config,
[#{dirs => ["src/**"],
filter => "*.erl",
ruleset => erl_files
},
#{dirs => ["test"],
filter => "*.erl",
ruleset => erl_files,
rules =>
[ { elvis_style
, no_debug_call
, disable
}
]
},
#{dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config
},
#{dirs => ["."],
filter => "elvis.config",
ruleset => elvis_config
}
]
}
]
}
].
93 changes: 93 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et

%% == Deps ==

{deps, [{eper, "~> 0.94.0"}]}.

%% == Erlang Compiler ==

{erl_opts, [ warn_unused_vars
, warnings_as_errors
, ewarn_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, {git, "https://github.com/inaka/katana-test.git", {ref, "b26165d"}}},
{mixer, {git, "https://github.com/inaka/mixer.git", {tag, "0.1.5"}}}
]}
]},
{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, []}.

%% == Cover ==

{cover_enabled, true}.

{cover_opts, [verbose]}.

{ct_extra_params, "-no_auto_compile -dir ebin -logdir log/ct --erl_args -smp enable -boot start_sasl"}.

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

{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, [sync]}]}.
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{<<"eper">>,{pkg,<<"eper">>,<<"0.94.0">>},0}].
9 changes: 9 additions & 0 deletions relx.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{release,
{beam_olympics, "0.0.1"},
[ kernel
, stdlib
, beam_olympics
]}.
{sys_config, "config/sys.config"}.
{extended_start_script, true}.
{vm_args, "config/vm.args"}.
19 changes: 19 additions & 0 deletions src/beam_olympics.app.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{application, beam_olympics, [
{description, "Let's find the best beamer!"},
{vsn, "0.0.1"},
{id, "beam_olympics"},
{registered, []},
{applications, [
kernel,
stdlib,
sasl
]},
{modules, []},
{mod, {bo, []}},
{env, []},
{maintainers, ["Inaka"]},
{licenses, ["Apache 2.0"]},
{links, [ {"Github", "https://github.com/inaka/beam_olympics"}
]},
{build_tools, ["rebar3"]}
]}.
33 changes: 33 additions & 0 deletions src/bo.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
%%% @doc Main Application Module
-module(bo).
-author('elbrujohalcon@inaka.net').

-behaviour(application).

-export([ start/0
, stop/0
, start/2
, stop/1
]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Start / Stop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% @doc Starts the Application
-spec start() -> {ok, [atom()]} | {error, term()}.
start() -> application:ensure_all_started(beam_olympics).

%% @doc Stops the Application
-spec stop() -> ok | {error, term()}.
stop() -> application:stop(beam_olympics).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Behaviour Callbacks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% @private
-spec start(application:start_type(), any()) -> {ok, pid()} | {error, term()}.
start(_StartType, _Args) -> {ok, self()}.

%% @private
-spec stop([]) -> ok.
stop([]) -> ok.
15 changes: 15 additions & 0 deletions test/bo_app_SUITE.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-module(bo_app_SUITE).
-author('elbrujohalcon@inaka.net').

-export([all/0]).
-export([run/1]).

-spec all() -> [atom()].
all() -> [run].

-spec run(proplists:proplist()) -> {comment, []}.
run(_Config) ->
{ok, Apps} = bo:start(),
[beam_olympics|_] = lists:reverse(Apps),
ok = bo:stop(),
{comment, ""}.