From e72f965e861127cd97cdef82905370540a0d4a80 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 19 Sep 2012 17:42:24 -0700 Subject: fully support testing of release builds --- src/rcl_release.erl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/rcl_release.erl') 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 -- cgit v1.2.3