[erlang-questions] Debugging apps with dependencies
Juan Jose Comellas
juanjo@REDACTED
Wed May 2 13:42:54 CEST 2012
BTW, I use a variant of what you showed that also starts dependencies
recursively. I normally create a module with the name of the project and
export the following functions to start it. That's what I use while testing.
-define(APP, ?MODULE).
%% @doc Start the application and all its dependencies.
-spec start() -> ok.
start() ->
start_deps(?APP),
application:start(?APP).
-spec start_deps(App :: atom()) -> ok.
start_deps(App) ->
application:load(App),
{ok, Deps} = application:get_key(App, applications),
lists:foreach(fun start_deps/1, Deps),
start_app(App).
-spec start_app(App :: atom()) -> ok.
start_app(App) ->
case application:start(App) of
{error, {already_started, _}} -> ok;
ok -> ok
end.
Juanjo
On Mon, Apr 30, 2012 at 3:39 PM, Bob Ippolito <bob@REDACTED> wrote:
> I haven't discovered a great workflow for developing with releases either,
> but you can start dependencies in a slightly cleaner way by looking at the
> app file:
>
> This would go in some module with the same name as the application, and
> you would call it with "erl ... -s modname"
>
> -export([start/0]).
>
> start() -> start(?MODULE).
>
> start(App) ->
> application:load(App),
> {ok, Deps} = application:get_key(App, applications),
> lists:foreach(fun start_app/1, Deps),
> application:start(App).
>
> start_app(App) ->
> case application:start(App) of
> {error, {already_started, _}} -> ok;
> ok -> ok
> end.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120502/05ad68a5/attachment.htm>
More information about the erlang-questions
mailing list