diff options
author | omarkj <omarkj@gmail.com> | 2014-11-03 13:58:58 -0800 |
---|---|---|
committer | omarkj <omarkj@gmail.com> | 2014-11-03 13:58:58 -0800 |
commit | a1d030c9649526422f58e0fb5dae9d33564b395a (patch) | |
tree | feb95f0fec3421ed876e1802584430e18e29f73f /src/rebar_plugins.erl | |
parent | 58f4019fa62a73e335967870f6605182d7386830 (diff) | |
parent | a3ec3a3424dd47e9687d0d2960ef2d3cba6a8f5c (diff) |
add help
Diffstat (limited to 'src/rebar_plugins.erl')
-rw-r--r-- | src/rebar_plugins.erl | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl index 0fdbc6d..b180ede 100644 --- a/src/rebar_plugins.erl +++ b/src/rebar_plugins.erl @@ -3,10 +3,36 @@ -module(rebar_plugins). --export([]). +-export([install/1]). -include("rebar.hrl"). %% =================================================================== %% Public API %% =================================================================== + +install(State) -> + State1 = rebar_state:set(State, deps_dir, ?DEFAULT_PLUGINS_DIR), + + Plugins = rebar_state:get(State1, plugins, []), + {ok, State2} = rebar_prv_install_deps:handle_deps(State1, Plugins), + + Apps = rebar_state:get(State2, all_deps, []), + ToBuild = lists:dropwhile(fun rebar_app_info:valid/1, Apps), + lists:foreach(fun(AppInfo) -> + C = rebar_config:consult(rebar_app_info:dir(AppInfo)), + S = rebar_state:new(rebar_state:new(), C, rebar_app_info:dir(AppInfo)), + rebar_prv_compile:build(S, AppInfo) + end, ToBuild), + + PluginProviders = plugin_providers(Plugins), + {ok, PluginProviders, rebar_state:set(State2, deps_dir, ?DEFAULT_DEPS_DIR)}. + +plugin_providers(Plugins) -> + lists:map(fun({Plugin, _, _}) when is_atom(Plugin) -> + Plugin; + ({Plugin, _}) when is_atom(Plugin) -> + Plugin; + (Plugin) when is_atom(Plugin) -> + Plugin + end, Plugins). |