Browse Source

Add hooks to the upgrade command

As requested in #1733
pull/1802/head
Fred Hebert 6 years ago
parent
commit
06147af85b
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      src/rebar_prv_upgrade.erl

+ 13
- 0
src/rebar_prv_upgrade.erl View File

@ -43,6 +43,19 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) -> do(State) ->
Cwd = rebar_state:dir(State),
Providers = rebar_state:providers(State),
rebar_hooks:run_project_and_app_hooks(Cwd, pre, ?PROVIDER, Providers, State),
case do_(State) of
{ok, NewState} ->
rebar_hooks:run_project_and_app_hooks(Cwd, post, ?PROVIDER, Providers, NewState),
{ok, NewState};
Other ->
rebar_hooks:run_project_and_app_hooks(Cwd, post, ?PROVIDER, Providers, State),
Other
end.
do_(State) ->
{Args, _} = rebar_state:command_parsed_args(State), {Args, _} = rebar_state:command_parsed_args(State),
Locks = rebar_state:get(State, {locks, default}, []), Locks = rebar_state:get(State, {locks, default}, []),
%% We have 3 sources of dependencies to upgrade from: %% We have 3 sources of dependencies to upgrade from:

Loading…
Cancel
Save