summaryrefslogtreecommitdiff
path: root/src/rebar_core.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2014-12-16 14:53:26 -0500
committerFred Hebert <mononcqc@ferd.ca>2014-12-16 14:53:26 -0500
commitb5500c7301eb6017d956b041daf4001d7b6cb3ff (patch)
treeb698186b6cfe8d64c3a8951748f838a734932998 /src/rebar_core.erl
parent0672fc45b797b9a496e5bf7797d2b7168f16ca42 (diff)
parent3998dfb049f8e48c4595b72913837a0b8095a0fe (diff)
Merge pull request #56 from tsloughter/profile_deps
rewrite profiles
Diffstat (limited to 'src/rebar_core.erl')
-rw-r--r--src/rebar_core.erl30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index 21d008a..fa0e459 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -40,17 +40,19 @@ process_command(State, Command) ->
not_found ->
{error, io_lib:format("Command ~p not found", [Command])};
CommandProvider ->
- Profile = providers:profile(CommandProvider),
- State1 = rebar_state:current_profile(State, Profile),
- Opts = providers:opts(CommandProvider)++rebar3:global_option_spec_list(),
case Command of
- do ->
- do(TargetProviders, State1);
+ Command when Command =:= do
+ ; Command =:= as ->
+ do(TargetProviders, State);
_ ->
+ Profile = providers:profile(CommandProvider),
+ State1 = rebar_state:apply_profiles(State, [Profile]),
+ Opts = providers:opts(CommandProvider)++rebar3:global_option_spec_list(),
+
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 +62,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 +77,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