forked from webmachine/webmachine
/
wmskel.erl
48 lines (42 loc) · 1.27 KB
/
wmskel.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
%% @author author <author@example.com>
%% @copyright YYYY author.
%% @doc {{appid}} startup code
-module({{appid}}).
-author('author <author@example.com>').
-export([start/0, start_link/0, stop/0]).
ensure_started(App) ->
case application:start(App) of
ok ->
ok;
{error, {already_started, App}} ->
ok
end.
%% @spec start_link() -> {ok,Pid::pid()}
%% @doc Starts the app for inclusion in a supervisor tree
start_link() ->
ensure_started(inets),
ensure_started(crypto),
ensure_started(mochiweb),
application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
ensure_started(webmachine),
{{appid}}_sup:start_link().
%% @spec start() -> ok
%% @doc Start the {{appid}} server.
start() ->
ensure_started(inets),
ensure_started(crypto),
ensure_started(mochiweb),
application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
ensure_started(webmachine),
application:start({{appid}}).
%% @spec stop() -> ok
%% @doc Stop the {{appid}} server.
stop() ->
Res = application:stop({{appid}}),
application:stop(webmachine),
application:stop(mochiweb),
application:stop(crypto),
application:stop(inets),
Res.