summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2018-06-06 07:26:19 -0400
committerGitHub <noreply@github.com>2018-06-06 07:26:19 -0400
commit1af7750eabcf32c221b7e4484e97356ad0b3f3b7 (patch)
tree14749d387ca041b83be6eedc7eae47894a95780b /src
parent88907b3aca18d7aebc43f0ac32ff19f0892a976c (diff)
parent06147af85baa1064c95f5fe5eb2c2d41a67c21a8 (diff)
Merge pull request #1802 from ferd/upgrade-hooks
Add hooks to the upgrade command
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_upgrade.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rebar_prv_upgrade.erl b/src/rebar_prv_upgrade.erl
index cd75672..e4469cf 100644
--- a/src/rebar_prv_upgrade.erl
+++ b/src/rebar_prv_upgrade.erl
@@ -43,6 +43,19 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
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),
Locks = rebar_state:get(State, {locks, default}, []),
%% We have 3 sources of dependencies to upgrade from: