aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_release.erl
diff options
context:
space:
mode:
authorEric <[email protected]>2012-09-19 17:42:24 -0700
committerEric <[email protected]>2012-09-19 17:52:04 -0700
commite72f965e861127cd97cdef82905370540a0d4a80 (patch)
tree4e615f6162afdfbac8eb1bfd3ce6422a609ef1a7 /src/rcl_release.erl
parent8f2670540b6cef76726224801a696cfbed4f3738 (diff)
downloadrelx-e72f965e861127cd97cdef82905370540a0d4a80.tar.gz
relx-e72f965e861127cd97cdef82905370540a0d4a80.tar.bz2
relx-e72f965e861127cd97cdef82905370540a0d4a80.zip
fully support testing of release builds
Diffstat (limited to 'src/rcl_release.erl')
-rw-r--r--src/rcl_release.erl17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/rcl_release.erl b/src/rcl_release.erl
index 9dbb866..f1a439c 100644
--- a/src/rcl_release.erl
+++ b/src/rcl_release.erl
@@ -33,6 +33,7 @@
applications/1,
application_details/1,
realized/1,
+ metadata/1,
format/1,
format/2,
format_error/1]).
@@ -142,6 +143,17 @@ application_details(#release_t{app_detail=App}) ->
realized(#release_t{realized=Realized}) ->
Realized.
+-spec metadata(t()) -> term().
+metadata(#release_t{name=Name, vsn=Vsn, erts=ErtsVsn, applications=Apps,
+ realized=Realized}) ->
+ case Realized of
+ true ->
+ {ok, {release, {erlang:atom_to_list(Name), Vsn}, {erts, ErtsVsn},
+ Apps}};
+ false ->
+ ?RCL_ERROR({not_realized, Name, Vsn})
+ end.
+
-spec format(t()) -> iolist().
format(Release) ->
format(0, Release).
@@ -177,7 +189,10 @@ format_error({topo_error, E}) ->
format_error({failed_to_parse, Con}) ->
io_lib:format("Failed to parse constraint ~p", [Con]);
format_error({invalid_constraint, Con}) ->
- io_lib:format("Invalid constraint specified ~p", [Con]).
+ io_lib:format("Invalid constraint specified ~p", [Con]);
+format_error({not_realized, Name, Vsn}) ->
+ io_lib:format("Unable to produce metadata release: ~p-~s has not been realized",
+ [Name, Vsn]).
%%%===================================================================
%%% Internal Functions