summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralisdair sullivan <alisdairsullivan@yahoo.ca>2015-03-01 20:32:57 -0800
committeralisdair sullivan <alisdairsullivan@yahoo.ca>2015-03-02 19:28:07 -0800
commit12726111bc827274fb71141ddaf6911b8e02d99c (patch)
tree046fa591435a7a05273d1b82fa63e3209e3a3bfd /src
parentbaf46a861b18086131707d056ee106c9fba8da3d (diff)
`add_to_profile/3` function added to `rebar_state`
Diffstat (limited to 'src')
-rw-r--r--src/rebar_state.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index 39e0e88..8170b8d 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -15,7 +15,7 @@
command_args/1, command_args/2,
command_parsed_args/1, command_parsed_args/2,
- apply_profiles/2,
+ add_to_profile/3, apply_profiles/2,
dir/1, dir/2,
create_logic_providers/2,
@@ -97,7 +97,6 @@ new(ParentState, Config, Dir) ->
D = proplists:get_value(deps, Config, []),
dict:from_list([{{deps, default}, D} | Config])
end,
-
NewOpts = dict:merge(fun(_Key, Value1, _Value2) ->
Value1
end, LocalOpts, Opts),
@@ -188,6 +187,13 @@ apply_overrides(State=#state_t{overrides=Overrides}, AppName) ->
StateAcc
end, State2, Overrides).
+add_to_profile(State, Profile, KVs) when is_atom(Profile), is_list(KVs) ->
+ Profiles = rebar_state:get(State, profiles, []),
+ ProfileOpts = dict:from_list(proplists:get_value(Profile, Profiles, [])),
+ NewOpts = merge_opts(Profile, dict:from_list(KVs), ProfileOpts),
+ NewProfiles = [{Profile, dict:to_list(NewOpts)}|lists:keydelete(Profile, 1, Profiles)],
+ rebar_state:set(State, profiles, NewProfiles).
+
apply_profiles(State, Profile) when not is_list(Profile) ->
apply_profiles(State, [Profile]);
apply_profiles(State, [default]) ->