diff options
author | Tristan Sloughter <t@crashfast.com> | 2014-12-07 18:39:26 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2014-12-16 10:01:36 -0600 |
commit | 3219a666f448b882c7534e200295be09ae6434fd (patch) | |
tree | 57b7d07b32e2e07fde09937118e84b465ab30672 /src/rebar_core.erl | |
parent | 0672fc45b797b9a496e5bf7797d2b7168f16ca42 (diff) |
rewrite profiles
Diffstat (limited to 'src/rebar_core.erl')
-rw-r--r-- | src/rebar_core.erl | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 21d008a..b82bfc0 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -41,7 +41,7 @@ process_command(State, Command) -> {error, io_lib:format("Command ~p not found", [Command])}; CommandProvider -> Profile = providers:profile(CommandProvider), - State1 = rebar_state:current_profile(State, Profile), + State1 = rebar_state:apply_profiles(State, [Profile]), Opts = providers:opts(CommandProvider)++rebar3:global_option_spec_list(), case Command of do -> @@ -49,8 +49,8 @@ process_command(State, Command) -> _ -> case getopt:parse(Opts, rebar_state:command_args(State1)) of {ok, Args} -> - State3 = rebar_state:command_parsed_args(State1, Args), - do(TargetProviders, State3); + State2 = rebar_state:command_parsed_args(State1, Args), + do(TargetProviders, State2); {error, {invalid_option, Option}} -> {error, io_lib:format("Invalid option ~s on task ~p", [Option, Command])} end @@ -60,13 +60,12 @@ process_command(State, Command) -> -spec do([{atom(), atom()}], rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do([], State) -> {ok, State}; -do([{ProviderName, Profile} | Rest], State) -> - State1 = rebar_state:current_profile(State, Profile), +do([{ProviderName, _} | Rest], State) -> Provider = providers:get_provider(ProviderName - ,rebar_state:providers(State1)), - case providers:do(Provider, State1) of - {ok, State2} -> - do(Rest, State2); + ,rebar_state:providers(State)), + case providers:do(Provider, State) of + {ok, State1} -> + do(Rest, State1); {error, Error} -> {error, Error} end. @@ -76,8 +75,7 @@ update_code_path(State) -> LibDirs = rebar_dir:lib_dirs(State), DepsDir = rebar_dir:deps_dir(State), PluginsDir = rebar_dir:plugins_dir(State), - _UpdatedCodePaths = update_code_path_([DepsDir, PluginsDir | LibDirs]). - + _UpdatedCodePaths = update_code_path_(lists:usort([DepsDir, PluginsDir | LibDirs])). %% =================================================================== %% Internal functions |