Current section
Files
Jump to
Current section
Files
src/erlzk_app.erl
%% 2013-2014 (c) Mega Yu <yuhg2310@gmail.com>
%% 2013-2014 (c) huaban.com <www.huaban.com>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
-module(erlzk_app).
-behaviour(application).
-export([start/2, stop/1]).
-export([ensure_deps_started/0]).
start(_Type, _Args) ->
erlzk_sup:start_link().
stop(_State) ->
ok.
ensure_deps_started() ->
{ok, Deps} = application:get_key(erlzk, applications),
true = lists:all(fun ensure_started/1, Deps).
ensure_started(App) ->
case application:start(App) of
ok ->
true;
{error, {already_started, App}} ->
true;
Else ->
error_logger:error_msg("Couldn't start ~p: ~p", [App, Else]),
Else
end.