aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_config.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rlx_prv_config.erl')
-rw-r--r--src/rlx_prv_config.erl64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/rlx_prv_config.erl b/src/rlx_prv_config.erl
index 2bc9851..36a0527 100644
--- a/src/rlx_prv_config.erl
+++ b/src/rlx_prv_config.erl
@@ -21,31 +21,31 @@
%%% A module that provides config parsing and support to the system
%%% @end
%%%-------------------------------------------------------------------
--module(rcl_prv_config).
+-module(rlx_prv_config).
--behaviour(rcl_provider).
+-behaviour(rlx_provider).
%% API
-export([init/1,
do/1,
format_error/1]).
--include_lib("relcool/include/relcool.hrl").
+-include_lib("relx/include/relx.hrl").
%%%===================================================================
%%% API
%%%===================================================================
%% @doc Required by the system, but not used in this provider
--spec init(rcl_state:t()) -> {ok, rcl_state:t()} | relcool:error().
+-spec init(rlx_state:t()) -> {ok, rlx_state:t()} | relx:error().
init(State) ->
{ok, State}.
%% @doc parse all the configs currently specified in the state,
%% populating the state as a result.
--spec do(rcl_state:t()) ->{ok, rcl_state:t()} | relcool:error().
+-spec do(rlx_state:t()) ->{ok, rlx_state:t()} | relx:error().
do(State) ->
- case rcl_state:config_file(State) of
+ case rlx_state:config_file(State) of
[] ->
search_for_dominating_config(State);
undefined ->
@@ -65,7 +65,7 @@ format_error({invalid_term, Term}) ->
%%% Internal Functions
%%%===================================================================
search_for_dominating_config({ok, Cwd}) ->
- ConfigFile = filename:join(Cwd, "relcool.config"),
+ ConfigFile = filename:join(Cwd, "relx.config"),
case ec_file:exists(ConfigFile) of
true ->
{ok, ConfigFile};
@@ -80,8 +80,8 @@ search_for_dominating_config(State0) ->
{ok, Config} ->
%% we need to set the root dir on state as well
{ok, RootDir} = parent_dir(Config),
- State1 = rcl_state:root_dir(State0, RootDir),
- load_config(Config, rcl_state:config_file(State1, Config));
+ State1 = rlx_state:root_dir(State0, RootDir),
+ load_config(Config, rlx_state:config_file(State1, Config));
no_config ->
{ok, State0}
end.
@@ -106,24 +106,24 @@ parent_dir([H | T], Acc) ->
parent_dir(T, [H | Acc]).
--spec load_config(file:filename(), rcl_state:t()) ->
- {ok, rcl_state:t()} | relcool:error().
+-spec load_config(file:filename(), rlx_state:t()) ->
+ {ok, rlx_state:t()} | relx:error().
load_config(ConfigFile, State) ->
{ok, CurrentCwd} = file:get_cwd(),
ok = file:set_cwd(filename:dirname(ConfigFile)),
Result = case file:consult(ConfigFile) of
{error, Reason} ->
- ?RCL_ERROR({consult, ConfigFile, Reason});
+ ?RLX_ERROR({consult, ConfigFile, Reason});
{ok, Terms} ->
lists:foldl(fun load_terms/2, {ok, State}, Terms)
end,
ok = file:set_cwd(CurrentCwd),
Result.
--spec load_terms(term(), {ok, rcl_state:t()} | relcool:error()) ->
- {ok, rcl_state:t()} | relcool:error().
+-spec load_terms(term(), {ok, rlx_state:t()} | relx:error()) ->
+ {ok, rlx_state:t()} | relx:error().
load_terms({default_release, RelName, RelVsn}, {ok, State}) ->
- {ok, rcl_state:default_configured_release(State, RelName, RelVsn)};
+ {ok, rlx_state:default_configured_release(State, RelName, RelVsn)};
load_terms({paths, Paths}, {ok, State}) ->
code:add_pathsa([filename:absname(Path) || Path <- Paths]),
{ok, State};
@@ -133,7 +133,7 @@ load_terms({providers, Providers0}, {ok, State0}) ->
{_, E={error, _}} ->
E;
{Providers3, {ok, State3}} ->
- {ok, rcl_state:providers(State3, Providers3)}
+ {ok, rlx_state:providers(State3, Providers3)}
end;
load_terms({add_providers, Providers0}, {ok, State0}) ->
Providers1 = gen_providers(Providers0, State0),
@@ -141,45 +141,45 @@ load_terms({add_providers, Providers0}, {ok, State0}) ->
{_, E={error, _}} ->
E;
{Providers3, {ok, State1}} ->
- ExistingProviders = rcl_state:providers(State1),
- {ok, rcl_state:providers(State1, ExistingProviders ++ Providers3)}
+ ExistingProviders = rlx_state:providers(State1),
+ {ok, rlx_state:providers(State1, ExistingProviders ++ Providers3)}
end;
load_terms({skip_apps, SkipApps0}, {ok, State0}) ->
- {ok, rcl_state:skip_apps(State0, SkipApps0)};
+ {ok, rlx_state:skip_apps(State0, SkipApps0)};
load_terms({overrides, Overrides0}, {ok, State0}) ->
- {ok, rcl_state:overrides(State0, Overrides0)};
+ {ok, rlx_state:overrides(State0, Overrides0)};
load_terms({release, {RelName, Vsn}, Applications}, {ok, State0}) ->
- Release0 = rcl_release:new(RelName, Vsn),
- case rcl_release:goals(Release0, Applications) of
+ Release0 = rlx_release:new(RelName, Vsn),
+ case rlx_release:goals(Release0, Applications) of
E={error, _} ->
E;
{ok, Release1} ->
- {ok, rcl_state:add_configured_release(State0, Release1)}
+ {ok, rlx_state:add_configured_release(State0, Release1)}
end;
load_terms({release, {RelName, Vsn}, {erts, ErtsVsn},
Applications}, {ok, State}) ->
- Release0 = rcl_release:erts(rcl_release:new(RelName, Vsn), ErtsVsn),
- case rcl_release:goals(Release0, Applications) of
+ Release0 = rlx_release:erts(rlx_release:new(RelName, Vsn), ErtsVsn),
+ case rlx_release:goals(Release0, Applications) of
E={error, _} ->
E;
{ok, Release1} ->
- {ok, rcl_state:add_configured_release(State, Release1)}
+ {ok, rlx_state:add_configured_release(State, Release1)}
end;
load_terms({sys_config, SysConfig}, {ok, State}) ->
- {ok, rcl_state:sys_config(State, filename:absname(SysConfig))};
+ {ok, rlx_state:sys_config(State, filename:absname(SysConfig))};
load_terms({Name, Value}, {ok, State})
when erlang:is_atom(Name) ->
- {ok, rcl_state:put(State, Name, Value)};
+ {ok, rlx_state:put(State, Name, Value)};
load_terms(_, Error={error, _}) ->
Error;
load_terms(InvalidTerm, _) ->
- ?RCL_ERROR({invalid_term, InvalidTerm}).
+ ?RLX_ERROR({invalid_term, InvalidTerm}).
--spec gen_providers([module()], rcl_state:t()) ->
- {[rcl_provider:t()], {ok, rcl_state:t()} | relcool:error()}.
+-spec gen_providers([module()], rlx_state:t()) ->
+ {[rlx_provider:t()], {ok, rlx_state:t()} | relx:error()}.
gen_providers(Providers, State) ->
lists:foldl(fun(ProviderName, {Providers1, {ok, State1}}) ->
- {Provider, State2} = rcl_provider:new(ProviderName, State1),
+ {Provider, State2} = rlx_provider:new(ProviderName, State1),
{[Provider | Providers1], State2};
(_, E={_, {error, _}}) ->
E