aboutsummaryrefslogtreecommitdiffstats
path: root/src/relx.erl
diff options
context:
space:
mode:
authorEric <[email protected]>2013-05-09 17:13:06 -0700
committerEric <[email protected]>2013-05-10 11:09:49 -0700
commitc5f0a8c9175b2d152c69f72da15e7ceff411f86b (patch)
tree1ae9a327feeb420983f9a85fdb6c800900369480 /src/relx.erl
parentefbdfbe117939cd50d0252a210b9b7634de42bb4 (diff)
downloadrelx-c5f0a8c9175b2d152c69f72da15e7ceff411f86b.tar.gz
relx-c5f0a8c9175b2d152c69f72da15e7ceff411f86b.tar.bz2
relx-c5f0a8c9175b2d152c69f72da15e7ceff411f86b.zip
internal rename completion of all relcool to relx calls
Diffstat (limited to 'src/relx.erl')
-rw-r--r--src/relx.erl92
1 files changed, 46 insertions, 46 deletions
diff --git a/src/relx.erl b/src/relx.erl
index c404e6f..30ee77f 100644
--- a/src/relx.erl
+++ b/src/relx.erl
@@ -18,7 +18,7 @@
%%% @author Eric Merritt <[email protected]>
%%% @copyright (C) 2012 Erlware, LLC.
%%% @doc
--module(relcool).
+-module(relx).
-export([main/1,
do/2,
@@ -30,82 +30,82 @@
-export_type([error/0]).
--include_lib("relcool/include/relcool.hrl").
+-include_lib("relx/include/relx.hrl").
%%============================================================================
%% types
%%============================================================================
-type error() :: {error, {Module::module(), Reason::term()}}.
--type goal() :: string() | binary() | rcl_depsolver:constraint().
+-type goal() :: string() | binary() | rlx_depsolver:constraint().
%%============================================================================
%% API
%%============================================================================
--spec main([string()]) -> ok | error() | {ok, rcl_state:t()}.
+-spec main([string()]) -> ok | error() | {ok, rlx_state:t()}.
main(Args) ->
OptSpecList = opt_spec_list(),
Result = case getopt:parse(OptSpecList, Args) of
{ok, {Options, NonOptions}} ->
do([{caller, command_line} | Options], NonOptions);
{error, Detail} ->
- ?RCL_ERROR({opt_parse, Detail})
+ ?RLX_ERROR({opt_parse, Detail})
end,
case Result of
{error, _} ->
- report_error(rcl_state:caller(rcl_state:new([], undefined),
+ report_error(rlx_state:caller(rlx_state:new([], undefined),
command_line),
Result);
_ ->
Result
end.
-%% @doc provides an API to run the Relcool process from erlang applications
+%% @doc provides an API to run the Relx process from erlang applications
%%
%% @param RelName - The release name to build (maybe `undefined`)
%% @param RelVsn - The release version to build (maybe `undefined`)
-%% @param Goals - The release goals for the system in depsolver or Relcool goal
+%% @param Goals - The release goals for the system in depsolver or Relx goal
%% format
%% @param LibDirs - The library dirs that should be used for the system
%% @param OutputDir - The directory where the release should be built to
%% @param Configs - The list of config files for the system
--spec do(atom(), string(), [goal()], [file:name()], rcl_log:log_level(),
+-spec do(atom(), string(), [goal()], [file:name()], rlx_log:log_level(),
[file:name()], file:name() | undefined) ->
- ok | error() | {ok, rcl_state:t()}.
+ ok | error() | {ok, rlx_state:t()}.
do(RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Config) ->
{ok, Cwd} = file:get_cwd(),
do(Cwd, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, [], Config).
-%% @doc provides an API to run the Relcool process from erlang applications
+%% @doc provides an API to run the Relx process from erlang applications
%%
%% @param RootDir - The root directory for the project
%% @param RelName - The release name to build (maybe `undefined`)
%% @param RelVsn - The release version to build (maybe `undefined`)
-%% @param Goals - The release goals for the system in depsolver or Relcool goal
+%% @param Goals - The release goals for the system in depsolver or Relx goal
%% format
%% @param LibDirs - The library dirs that should be used for the system
%% @param OutputDir - The directory where the release should be built to
%% @param Configs - The list of config files for the system
-spec do(file:name(), atom(), string(), [goal()], [file:name()],
- rcl_log:log_level(), [file:name()], file:name() | undefined) ->
- ok | error() | {ok, rcl_state:t()}.
+ rlx_log:log_level(), [file:name()], file:name() | undefined) ->
+ ok | error() | {ok, rlx_state:t()}.
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Configs) ->
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, [], Configs).
-%% @doc provides an API to run the Relcool process from erlang applications
+%% @doc provides an API to run the Relx process from erlang applications
%%
%% @param RootDir - The root directory for the system
%% @param RelName - The release name to build (maybe `undefined`)
%% @param RelVsn - The release version to build (maybe `undefined`)
-%% @param Goals - The release goals for the system in depsolver or Relcool goal
+%% @param Goals - The release goals for the system in depsolver or Relx goal
%% format
%% @param LibDirs - The library dirs that should be used for the system
%% @param OutputDir - The directory where the release should be built to
%% @param Overrides - A list of overrides for the system
%% @param Configs - The list of config files for the system
-spec do(file:name(), atom(), string(), [goal()], [file:name()],
- rcl_log:log_level(), [file:name()], [{atom(), file:name()}], file:name() | undefined) ->
- ok | error() | {ok, rcl_state:t()}.
+ rlx_log:log_level(), [file:name()], [{atom(), file:name()}], file:name() | undefined) ->
+ ok | error() | {ok, rlx_state:t()}.
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Config) ->
do([{relname, RelName},
{relvsn, RelVsn},
@@ -118,7 +118,7 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Con
{config, Config}],
["release"]).
-%% @doc provides an API to run the Relcool process from erlang applications
+%% @doc provides an API to run the Relx process from erlang applications
%%
%% @param Opts - A proplist of options. There are good defaults for each of
%% these entries, so any or all may be omitted. Individual options may be:
@@ -129,7 +129,7 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Con
%% <dt><pre>{relvsn, RelVsn}</pre></dt>
%% <dd>The release version to build</dd>
%% <dt><pre>{goals, Goals}</pre></dt>
-%% <dd>The release goals for the system in depsolver or Relcool goal
+%% <dd>The release goals for the system in depsolver or Relx goal
%% format (@see goals())</dd>
%% <dt><pre>{lib_dirs, LibDirs}</pre></dt>
%% <dd>A list of library dirs that should be used for the system</dd>
@@ -139,9 +139,9 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Con
%% <dt><pre>{output_dir, OutputDir}</pre></dt>
%% <dd>The directory where the release should be built to</dd>
%% <dt><pre>{root_dir, RootDir}</pre></dt>
-%% <dd>The base directory for this run of relcool. </dd>
+%% <dd>The base directory for this run of relx. </dd>
%% <dt><pre>{config, Config}</pre></dt>
-%% <dd>The path to a relcool config file</dd>
+%% <dd>The path to a relx config file</dd>
%% <dt><pre>{log_level, LogLevel}</pre></dt>
%% <dd>Defines the verbosity of output. Maybe a number between 0 and 2, with
%% with higher values being more verbose</dd>
@@ -154,11 +154,11 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Con
%% Overrides</dd>
%% </dl>
-spec do(proplists:proplist(), [string()]) ->
- ok | error() | {ok, rcl_state:t()}.
+ ok | error() | {ok, rlx_state:t()}.
do(Opts, NonOpts) ->
- case rcl_cmd_args:args2state(Opts, NonOpts) of
+ case rlx_cmd_args:args2state(Opts, NonOpts) of
{ok, State} ->
- run_relcool_process(State);
+ run_relx_process(State);
Error={error, _} ->
Error
end.
@@ -188,7 +188,7 @@ opt_spec_list() ->
-spec format_error(Reason::term()) -> iolist().
format_error({invalid_return_value, Provider, Value}) ->
- [rcl_provider:format(Provider), " returned an invalid value ",
+ [rlx_provider:format(Provider), " returned an invalid value ",
io_lib:format("~p", [Value])];
format_error({opt_parse, {invalid_option, Opt}}) ->
io_lib:format("invalid option ~s~n", [Opt]);
@@ -200,11 +200,11 @@ format_error({error, {Module, Reason}}) ->
%%============================================================================
%% internal api
%%============================================================================
-run_relcool_process(State) ->
- rcl_log:info(rcl_state:log(State), "Starting relcool build process ..."),
- rcl_log:debug(rcl_state:log(State),
+run_relx_process(State) ->
+ rlx_log:info(rlx_state:log(State), "Starting relx build process ..."),
+ rlx_log:debug(rlx_state:log(State),
fun() ->
- rcl_state:format(State)
+ rlx_state:format(State)
end),
run_providers(State).
@@ -214,16 +214,16 @@ run_relcool_process(State) ->
%% providers again and run the rest of them (because they could have been
%% updated by the config process).
run_providers(State0) ->
- [ConfigProvider | _] = rcl_state:providers(State0),
+ [ConfigProvider | _] = rlx_state:providers(State0),
case run_provider(ConfigProvider, {ok, State0}) of
Err = {error, _} ->
Err;
{ok, State1} ->
- RootDir = rcl_state:root_dir(State1),
+ RootDir = rlx_state:root_dir(State1),
ok = file:set_cwd(RootDir),
- Providers = rcl_state:providers(State1),
+ Providers = rlx_state:providers(State1),
Result = run_providers(ConfigProvider, Providers, State1),
- handle_output(State1, rcl_state:caller(State1), Result)
+ handle_output(State1, rlx_state:caller(State1), Result)
end.
handle_output(State, command_line, E={error, _}) ->
@@ -244,33 +244,33 @@ run_providers(ConfigProvider, Providers, State0) ->
lists:foldl(fun run_provider/2, {ok, State0}, Providers)
end.
--spec run_provider(rcl_provider:t(), {ok, rcl_state:t()} | error()) ->
- {ok, rcl_state:t()} | error().
+-spec run_provider(rlx_provider:t(), {ok, rlx_state:t()} | error()) ->
+ {ok, rlx_state:t()} | error().
run_provider(_Provider, Error = {error, _}) ->
Error;
run_provider(Provider, {ok, State0}) ->
- rcl_log:debug(rcl_state:log(State0), "Running provider ~p~n",
- [rcl_provider:impl(Provider)]),
- case rcl_provider:do(Provider, State0) of
+ rlx_log:debug(rlx_state:log(State0), "Running provider ~p~n",
+ [rlx_provider:impl(Provider)]),
+ case rlx_provider:do(Provider, State0) of
{ok, State1} ->
- rcl_log:debug(rcl_state:log(State0), "Provider successfully run: ~p~n",
- [rcl_provider:impl(Provider)]),
+ rlx_log:debug(rlx_state:log(State0), "Provider successfully run: ~p~n",
+ [rlx_provider:impl(Provider)]),
{ok, State1};
E={error, _} ->
- rcl_log:debug(rcl_state:log(State0), "Provider (~p) failed with: ~p~n",
- [rcl_provider:impl(Provider), E]),
+ rlx_log:debug(rlx_state:log(State0), "Provider (~p) failed with: ~p~n",
+ [rlx_provider:impl(Provider), E]),
E
end.
-spec usage() -> ok.
usage() ->
- getopt:usage(opt_spec_list(), "relcool", "[*release-specification-file*]").
+ getopt:usage(opt_spec_list(), "relx", "[*release-specification-file*]").
--spec report_error(rcl_state:t(), error()) -> none() | error().
+-spec report_error(rlx_state:t(), error()) -> none() | error().
report_error(State, Error) ->
io:format(format_error(Error)),
usage(),
- case rcl_state:caller(State) of
+ case rlx_state:caller(State) of
command_line ->
erlang:halt(127);
api ->