diff options
author | Alexey Romanov <alexey.v.romanov@gmail.com> | 2011-03-05 14:11:31 +0300 |
---|---|---|
committer | Alexey Romanov <alexey.v.romanov@gmail.com> | 2011-03-05 14:11:31 +0300 |
commit | 7c40d624dc344e534c7b576341463648091f56e8 (patch) | |
tree | 4b384980bd6fe327cdecf25c55a6dd2622cd8412 /src/rebar_rel_utils.erl | |
parent | 48d23b90acb688a68354b20a1b19fa0aa0e592be (diff) | |
parent | 25c0226ab94560c5e182944c4c71b9f71ac3f08e (diff) |
Merge commit 'upstream/master'
Diffstat (limited to 'src/rebar_rel_utils.erl')
-rw-r--r-- | src/rebar_rel_utils.erl | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/rebar_rel_utils.erl b/src/rebar_rel_utils.erl index 9729e20..d3baf4d 100644 --- a/src/rebar_rel_utils.erl +++ b/src/rebar_rel_utils.erl @@ -31,7 +31,10 @@ get_reltool_release_info/1, get_rel_release_info/1, get_rel_release_info/2, - get_previous_release_path/0]). + get_rel_apps/1, + get_rel_apps/2, + get_previous_release_path/0, + get_rel_file_path/2]). -include("rebar.hrl"). @@ -70,11 +73,29 @@ get_rel_release_info(RelFile) -> %% Get release name and version from a name and a path get_rel_release_info(Name, Path) -> + RelPath = get_rel_file_path(Name, Path), + get_rel_release_info(RelPath). + +%% Get list of apps included in a release from a rel file +get_rel_apps(RelFile) -> + case file:consult(RelFile) of + {ok, [{release, _, _, Apps}]} -> + Apps; + _ -> + ?ABORT("Failed to parse ~s~n", [RelFile]) + end. + +%% Get list of apps included in a release from a name and a path +get_rel_apps(Name, Path) -> + RelPath = get_rel_file_path(Name, Path), + get_rel_apps(RelPath). + +%% Get rel file path from name and path +get_rel_file_path(Name, Path) -> [RelFile] = filelib:wildcard(filename:join([Path, "releases", "*", Name ++ ".rel"])), [BinDir|_] = re:replace(RelFile, Name ++ "\\.rel", ""), - get_rel_release_info(filename:join([binary_to_list(BinDir), - Name ++ ".rel"])). + filename:join([binary_to_list(BinDir), Name ++ ".rel"]). %% Get the previous release path from a global variable get_previous_release_path() -> |