rabbitmq-erlang-client and rebar

Tim Watson watson.timothy at gmail.com
Thu Jul 28 18:19:21 EDT 2011


> Anyways, the question is:
> what would be the best approach to deal with this problem? i.e. maybe
> there is a way in rebar to specify some sort of 'pre-run' execution
> hooks  in form of shell commands, which would get executed before
> is_app_available() is called on each of the deps?

Rebar has exactly this mechanism:

{pre_hooks, [
    {'check-deps', "./prefetch_rabbit"},
    {compile, "cd deps/rabbitmq && autoconf -vif && ./configure
--prefix=`pwd` && make install"}
]}.

You can also, if you so desire, write a build plugin in erlang and do
the work there rather than using shell scripts and/or commands. It
needs to be compiled and on the code path (e.g., in $ERL_LIBS) in
order to get picked up - work on picking plugins up dynamically from
sources is in the pipeline.

%% your plugin source should look like this
-module(rabbit_prefetch_plugin).
-export([pre_compile/2]).

pre_compile(Config, PathToAppFile) ->
    %% TODO: implement this
    ok.

%% you rebar config should look like this
{rebar_plugins, [rabbit_prefetch_plugin]}.



More information about the rebar mailing list