Просмотр исходного кода

remove large comment blocks from templates and use maps in sup

pull/2069/head
Tristan Sloughter 6 лет назад
Родитель
Сommit
052a4e8428
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: AAB97DDECCEB8150
3 измененных файлов: 16 добавлений и 37 удалений
  1. +1
    -9
      priv/templates/app.erl
  2. +0
    -10
      priv/templates/mod.erl
  3. +15
    -18
      priv/templates/sup.erl

+ 1
- 9
priv/templates/app.erl Просмотреть файл

@ -7,20 +7,12 @@
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).
%%====================================================================
%% API
%%====================================================================
start(_StartType, _StartArgs) ->
{{name}}_sup:start_link().
%%--------------------------------------------------------------------
stop(_State) ->
ok.
%%====================================================================
%% Internal functions
%%====================================================================
%% internal functions

+ 0
- 10
priv/templates/mod.erl Просмотреть файл

@ -1,13 +1,3 @@
-module({{name}}).
%% API exports
-export([]).
%%====================================================================
%% API functions
%%====================================================================
%%====================================================================
%% Internal functions
%%====================================================================

+ 15
- 18
priv/templates/sup.erl Просмотреть файл

@ -8,32 +8,29 @@
-behaviour(supervisor).
%% API
-export([start_link/0]).
%% Supervisor callbacks
-export([init/1]).
-define(SERVER, ?MODULE).
%%====================================================================
%% API functions
%%====================================================================
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
%%====================================================================
%% Supervisor callbacks
%%====================================================================
%% Child :: #{id => Id, start => {M, F, A}}
%% Optional keys are restart, shutdown, type, modules.
%% Before OTP 18 tuples must be used to specify a child. e.g.
%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
%% sup_flags() = #{strategy => strategy(), % optional
%% intensity => non_neg_integer(), % optional
%% period => pos_integer()} % optional
%% child_spec() = #{id => child_id(), % mandatory
%% start => mfargs(), % mandatory
%% restart => restart(), % optional
%% shutdown => shutdown(), % optional
%% type => worker(), % optional
%% modules => modules()} % optional
init([]) ->
{ok, {{one_for_all, 0, 1}, []}}.
SupFlags = #{strategy => one_for_all
intensity => 0,
period => 1},
ChildSpecs = [],
{ok, {SupFlags, ChildSpecs}}.
%%====================================================================
%% Internal functions
%%====================================================================
%% internal functions

Загрузка…
Отмена
Сохранить