Merge pull request #10 from lwes/feature/fixes
[lwes-erlang/github-mirror.git] / src / lwes_app.erl
blob96f1547cdcb6ca7dd4702940e782a34139fabcfc
1 -module (lwes_app).
3 -behaviour (application).
5 %% API
6 -export([start/0]).
8 %% application callbacks
9 -export ([start/2, stop/1]).
11 %-=====================================================================-
12 %- API -
13 %-=====================================================================-
14 start () ->
15 [ensure_started (App) || App <- [sasl, lwes]].
17 %-=====================================================================-
18 %- application callbacks -
19 %-=====================================================================-
20 start (_Type, _Args) ->
21 lwes_sup:start_link().
23 stop (_State) ->
24 ok.
26 %-=====================================================================-
27 %- Private -
28 %-=====================================================================-
29 ensure_started(App) ->
30 case application:start(App) of
31 ok ->
32 ok;
33 {error, {already_started, App}} ->
35 end.
37 %-=====================================================================-
38 %- Test Functions -
39 %-=====================================================================-
40 -ifdef (TEST).
41 -include_lib ("eunit/include/eunit.hrl").
43 lwes_app_test_ () ->
45 ?_assertEqual ([ok, ok],lwes_app:start()),
46 ?_assertEqual ([ok, ok],lwes_app:start()),
47 ?_assertEqual (ok, application:stop (lwes))
50 -endif.