Permalink
Browse files

Instead of restartign agner in rebar plugin, ensure agner is loaded.

  • Loading branch information...
1 parent b9f9f88 commit 0edbd79a992008589e34e8824a1c598f5e37ed90 @yrashk yrashk committed Jun 28, 2011
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/agner_rebar_plugin.erl
View
@@ -9,20 +9,27 @@
pre_compile(Config, AppFile).
'get-deps'(Config, AppFile) ->
- agner:start(),
+ ensure_agner_started(),
set_indices(Config),
agner_main:handle_command(fetch,[{app, AppFile},{version, "@master"},{addpath, false},
- {install, false},{build, false}]),
- agner:stop().
+ {install, false},{build, false}]).
pre_compile(Config, AppFile) ->
- agner:start(),
+ ensure_agner_started(),
set_indices(Config),
agner_main:handle_command(build,[{app, AppFile},{version, "@master"},{quiet, false},
{nofetch, true},
{addpath, false},
- {install, false}]),
- agner:stop().
+ {install, false}]).
set_indices(Config) ->
application:set_env(agner, indices, rebar_config:get_local(Config, agner_indices, [{github,"agner"}])).
+
+ensure_agner_started() ->
+ case proplists:get_value(agner, application:loaded_applications()) of
+ undefined ->
+ agner:start();
+ _ ->
+ ok %% already started
+ end.
+

0 comments on commit 0edbd79

Please sign in to comment.