diff options
author | Jordan Wilberding <[email protected]> | 2014-05-15 08:41:21 +0200 |
---|---|---|
committer | Jordan Wilberding <[email protected]> | 2014-05-15 08:41:21 +0200 |
commit | 09d7273631bf13baaa923c9f22892db192d799bb (patch) | |
tree | 967afbea1f132b9a962ea00f90b9680bc1f1e185 /src/rlx_util.erl | |
parent | 227b1ec27d9b4c186366a64f81628843c8a8cc3e (diff) | |
parent | dd55959854069553b40f2bc2f2f7c5c7fc7c5a94 (diff) | |
download | relx-09d7273631bf13baaa923c9f22892db192d799bb.tar.gz relx-09d7273631bf13baaa923c9f22892db192d799bb.tar.bz2 relx-09d7273631bf13baaa923c9f22892db192d799bb.zip |
Merge pull request #177 from tsloughter/refactor1.0.0-rc1
refactor of command line and config file settings
Diffstat (limited to 'src/rlx_util.erl')
-rw-r--r-- | src/rlx_util.erl | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/rlx_util.erl b/src/rlx_util.erl index 48e2ee1..9c4dcc2 100644 --- a/src/rlx_util.erl +++ b/src/rlx_util.erl @@ -21,7 +21,10 @@ %%% @doc Trivial utility file to help handle common tasks -module(rlx_util). --export([mkdir_p/1, +-export([get_code_paths/2, + release_output_dir/2, + make_script/2, + mkdir_p/1, to_binary/1, to_string/1, to_atom/1, @@ -40,6 +43,36 @@ %%============================================================================ %% API %%============================================================================ + +%% @doc Generates the correct set of code paths for the system. +-spec get_code_paths(rlx_release:t(), file:name()) -> [file:name()]. +get_code_paths(Release, OutDir) -> + LibDir = filename:join(OutDir, "lib"), + [filename:join([LibDir, + erlang:atom_to_list(rlx_app_info:name(App)) ++ "-" ++ + rlx_app_info:original_vsn(App), "ebin"]) || + App <- rlx_release:application_details(Release)]. + +-spec release_output_dir(rlx_state:t(), rlx_release:t()) -> string(). +release_output_dir(State, Release) -> + OutputDir = rlx_state:output_dir(State), + filename:join([OutputDir, + "releases", + rlx_release:vsn(Release)]). + +-spec make_script([term()], + fun(([term()]) -> Res)) -> Res. +make_script(Options, RunFun) -> + %% Erts 5.9 introduced a non backwards compatible option to + %% erlang this takes that into account + Erts = erlang:system_info(version), + case ec_semver:gte(Erts, "5.9") of + true -> + RunFun([no_warn_sasl | Options]); + _ -> + RunFun(Options) + end. + %% @doc Makes a directory including parent dirs if they are missing. -spec mkdir_p(string()) -> ok | {error, Reason::file:posix()}. mkdir_p(Path) -> |