summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-04-22 18:17:33 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-04-23 23:13:55 +0200
commitb2fdce887911d14af7063317ef118680a2754048 (patch)
tree89647c991815e2de3b7ba14f0972fff60ff982e8 /src
parentd726e598b5ba5948808b79e86946b45f89e8c963 (diff)
Use dict() instead of proplist() for shared env
Diffstat (limited to 'src')
-rw-r--r--src/rebar_config.erl15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/rebar_config.erl b/src/rebar_config.erl
index 8065c4e..7f7d03c 100644
--- a/src/rebar_config.erl
+++ b/src/rebar_config.erl
@@ -38,10 +38,7 @@
-record(config, { dir :: file:filename(),
opts = [] :: list(),
- envs = [] :: list({module(), env()}) }).
-
--type env() :: [env_var()].
--type env_var() :: {string(), string()}.
+ envs = new_env() :: dict() }).
%% Types that can be used from other modules -- alphabetically ordered.
-export_type([config/0]).
@@ -149,14 +146,11 @@ consult_file(File) ->
set_env(Config, Mod, Env) ->
OldEnvs = Config#config.envs,
- NewEnvs = case lists:keymember(Mod, 1, OldEnvs) of
- true -> lists:keyreplace(Mod, 1, OldEnvs, {Mod, Env});
- false -> [{Mod,Env}|OldEnvs]
- end,
+ NewEnvs = dict:store(Mod, Env, OldEnvs),
Config#config{envs=NewEnvs}.
get_env(Config, Mod) ->
- proplists:get_value(Mod, Config#config.envs, []).
+ dict:fetch(Mod, Config#config.envs).
%% ===================================================================
%% Internal functions
@@ -193,3 +187,6 @@ local_opts([local | _Rest], Acc) ->
lists:reverse(Acc);
local_opts([Item | Rest], Acc) ->
local_opts(Rest, [Item | Acc]).
+
+new_env() ->
+ dict:new().