summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-29 18:06:34 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-29 18:06:34 +0100
commit2de8c9028efccecf5029b479ba90bad3592b06bf (patch)
tree404ed274e550cce7fbbd98c44aec77d84a526c98 /src
parent034cccc3889642afc00cef273a25eebbe8719c08 (diff)
downloadrabbitmq-server-git-2de8c9028efccecf5029b479ba90bad3592b06bf.tar.gz
refactor
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_plugins.erl19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index f07cff7231..f10e6536a9 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -307,15 +307,20 @@ plugins_cmp(#plugin{name = N1, version = V1},
#plugin{name = N2, version = V2}) ->
{N1, V1} =< {N2, V2}.
-%% Filter applications that can be loaded *right now*.
+%% Filter out applications that can be loaded *right now*.
filter_applications(Applications) ->
[Application || Application <- Applications,
- case application:load(Application) of
- {error, {already_loaded, _}} -> false;
- ok -> application:unload(Application),
- false;
- _ -> true
- end].
+ not is_available_app(Application)].
+
+%% Return whether is application is already available (and hence
+%% doesn't need enabling).
+is_available_app(Application) ->
+ case application:load(Application) of
+ {error, {already_loaded, _}} -> true;
+ ok -> application:unload(Application),
+ true;
+ _ -> false
+ end.
%% Return the names of the given plugins.
plugin_names(Plugins) ->