PageRenderTime 25ms CodeModel.GetById 12ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 1ms

/deps/webmachine/priv/skel/src/skel.erl

http://github.com/zotonic/zotonic
Erlang | 44 lines | 29 code | 6 blank | 9 comment | 0 complexity | 404f787f274c58ff1b1752667c835c33 MD5 | raw file
 1%% @author author <author@example.com>
 2%% @copyright YYYY author.
 3
 4%% @doc TEMPLATE.
 5
 6-module(skel).
 7-author('author <author@example.com>').
 8-export([start/0, start_link/0, stop/0]).
 9
10ensure_started(App) ->
11    case application:start(App) of
12	ok ->
13	    ok;
14	{error, {already_started, App}} ->
15	    ok
16    end.
17
18%% @spec start_link() -> {ok,Pid::pid()}
19%% @doc Starts the app for inclusion in a supervisor tree
20start_link() ->
21    skel_deps:ensure(),
22    ensure_started(crypto),
23    application:set_env(webmachine, webmachine_logger_module, 
24                        webmachine_logger),
25    ensure_started(webmachine),
26    skel_sup:start_link().
27
28%% @spec start() -> ok
29%% @doc Start the skel server.
30start() ->
31    skel_deps:ensure(),
32    ensure_started(crypto),
33    application:set_env(webmachine, webmachine_logger_module, 
34                        webmachine_logger),
35    ensure_started(webmachine),
36    application:start(skel).
37
38%% @spec stop() -> ok
39%% @doc Stop the skel server.
40stop() ->
41    Res = application:stop(skel),
42    application:stop(webmachine),
43    application:stop(crypto),
44    Res.