diff options
| author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-09 12:11:54 +0100 |
|---|---|---|
| committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-09 12:11:54 +0100 |
| commit | aaa1c65236c48b856a6c900b74621777a785c18b (patch) | |
| tree | 465b9da3dc2dc1bebf2bb5ba407b1d5be0efad90 | |
| parent | ab2f7d3b940f8ab13287faa5057d6047a58abcf4 (diff) | |
| download | rabbitmq-server-git-aaa1c65236c48b856a6c900b74621777a785c18b.tar.gz | |
pass PLUGINS_DIR and PLUGINS_DIST_DIR to rabbitmq-plugin
| -rwxr-xr-x | scripts/rabbitmq-plugin | 6 | ||||
| -rwxr-xr-x | scripts/rabbitmq-plugin.bat | 7 | ||||
| -rw-r--r-- | src/rabbit_plugin.erl | 13 |
3 files changed, 21 insertions, 5 deletions
diff --git a/scripts/rabbitmq-plugin b/scripts/rabbitmq-plugin index a1f0883707..4583873072 100755 --- a/scripts/rabbitmq-plugin +++ b/scripts/rabbitmq-plugin @@ -17,10 +17,16 @@ . `dirname $0`/rabbitmq-env +[ "x" = "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR="${RABBITMQ_HOME}/plugins" + +[ "x" = "x$RABBITMQ_PLUGINS_DIST_DIR" ] && RABBITMQ_PLUGINS_DIST_DIR="${RABBITMQ_HOME}/provided_plugins" + exec erl \ -pa "${RABBITMQ_HOME}/ebin" \ -noinput \ -hidden \ -sname rabbitmq-plugin$$ \ -s rabbit_plugin \ + -plugins_dir "$RABBITMQ_PLUGINS_DIR" \ + -plugins_dist_dir "$RABBITMQ_PLUGINS_DIST_DIR" \ -extra "$@" diff --git a/scripts/rabbitmq-plugin.bat b/scripts/rabbitmq-plugin.bat index e557501f68..0aaad0ef3c 100755 --- a/scripts/rabbitmq-plugin.bat +++ b/scripts/rabbitmq-plugin.bat @@ -26,7 +26,7 @@ setlocal enabledelayedexpansion if not exist "!ERLANG_HOME!\bin\erl.exe" (
echo.
echo ******************************
- echo ERLANG_HOME not set correctly.
+ echo ERLANG_HOME not set correctly.
echo ******************************
echo.
echo Please either set ERLANG_HOME to point to your Erlang installation or place the
@@ -35,7 +35,10 @@ if not exist "!ERLANG_HOME!\bin\erl.exe" ( exit /B
)
-"!ERLANG_HOME!\bin\erl.exe" -pa "!TDP0!..\ebin" -noinput -hidden -sname rabbitmq-plugin!RANDOM! -s rabbit_plugin -extra !STAR!
+set RABBITMQ_PLUGINS_DIR=!TDP0!..\plugins
+set RABBITMQ_PLUGINS_DIST_DIR=!TDP0!..\provided_plugins
+
+"!ERLANG_HOME!\bin\erl.exe" -pa "!TDP0!..\ebin" -noinput -hidden -sname rabbitmq-plugin!RANDOM! -s rabbit_plugin -plugins_dir "!RABBITMQ_PLUGINS_DIR:\=/!" -plugins_dist_dir "!RABBITMQ_PLUGINS_DIST_DIR:\=/!" -extra !STAR!
endlocal
endlocal
diff --git a/src/rabbit_plugin.erl b/src/rabbit_plugin.erl index b271652bee..9120d47076 100644 --- a/src/rabbit_plugin.erl +++ b/src/rabbit_plugin.erl @@ -33,6 +33,8 @@ %%---------------------------------------------------------------------------- start() -> + {ok, [[PluginsDir|_]|_]} = init:get_argument(plugins_dir), + {ok, [[PluginsDistDir|_]|_]} = init:get_argument(plugins_dist_dir), {[Command0 | Args], Opts} = case rabbit_misc:get_options([{flag, ?FORCE_OPT}], init:get_plain_arguments()) of @@ -41,7 +43,7 @@ start() -> end, Command = list_to_atom(Command0), - case catch action(Command, Args, Opts) of + case catch action(Command, Args, Opts, PluginsDir, PluginsDistDir) of ok -> rabbit_misc:quit(0); {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> @@ -68,5 +70,10 @@ usage() -> %%---------------------------------------------------------------------------- -action(test, [], _Opts) -> - io:format("Test ok~n"). +action(list, [], _Opts, PluginsDir, PluginsDistDir) -> + io:format("All plugins: ~p~n", [find_available_plugins(PluginsDistDir)]). + +%%---------------------------------------------------------------------------- + +find_available_plugins(PluginsDistDir) -> + filelib:wildcard("*.ez", PluginsDistDir). |
