瀏覽代碼

check global for plugin if not found in local profiles

pull/544/head
Tristan Sloughter 9 年之前
父節點
當前提交
b830c65ef0
共有 1 個文件被更改,包括 17 次插入9 次删除
  1. +17
    -9
      src/rebar_prv_plugins_upgrade.erl

+ 17
- 9
src/rebar_prv_plugins_upgrade.erl 查看文件

@ -50,15 +50,12 @@ format_error(Reason) ->
upgrade(Plugin, State) ->
Profiles = rebar_state:current_profiles(State),
Dep = ec_lists:search(fun(Profile) ->
Plugins = rebar_state:get(State, {plugins, Profile}, []),
case find(list_to_atom(Plugin), Plugins) of
false ->
not_found;
P ->
{ok, P}
end
end, Profiles),
case find_plugin(Plugin, Profiles, State) of
not_found ->
Dep = find_plugin(Plugin, [global], State);
Dep ->
Dep
end,
case Dep of
not_found ->
@ -82,6 +79,17 @@ upgrade(Plugin, State) ->
{ok, State}
end.
find_plugin(Plugin, Profiles, State) ->
ec_lists:search(fun(Profile) ->
Plugins = rebar_state:get(State, {plugins, Profile}, []),
case find(list_to_atom(Plugin), Plugins) of
false ->
not_found;
P ->
{ok, P}
end
end, Profiles).
find(_Plugin, []) ->
false;
find(Plugin, [Plugin | _Plugins]) ->

Loading…
取消
儲存