summaryrefslogtreecommitdiff
path: root/src/rebar_require_vsn.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_require_vsn.erl')
-rw-r--r--src/rebar_require_vsn.erl32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/rebar_require_vsn.erl b/src/rebar_require_vsn.erl
index 83cb79d..385f55c 100644
--- a/src/rebar_require_vsn.erl
+++ b/src/rebar_require_vsn.erl
@@ -33,6 +33,9 @@
-export([compile/2,
eunit/2]).
+%% for internal use only
+-export([info/2]).
+
%% ===================================================================
%% Public API
%% ===================================================================
@@ -47,6 +50,25 @@ eunit(Config, _) ->
%% Internal functions
%% ====================================================================
+info(help, compile) ->
+ info_help();
+info(help, eunit) ->
+ info_help().
+
+info_help() ->
+ ?CONSOLE(
+ "Check required ERTS or OTP release version.~n"
+ "~n"
+ "Valid rebar.config options:~n"
+ " ~p~n"
+ " ~p~n"
+ " ~p~n",
+ [
+ {require_erts_vsn, ".*"},
+ {require_otp_vsn, ".*"},
+ {require_min_otp_vsn, ".*"}
+ ]).
+
check_versions(Config) ->
ErtsRegex = rebar_config:get(Config, require_erts_vsn, ".*"),
ReOpts = [{capture, none}],
@@ -77,18 +99,18 @@ check_versions(Config) ->
"OTP Release"),
case {OtpMaj, OtpMin} >= {MinMaj, MinMin} of
true ->
- ?DEBUG("~s satisfies the requirement for vsn ~s~n",
- [erlang:system_info(otp_release),
+ ?DEBUG("~s satisfies the requirement for vsn ~s~n",
+ [erlang:system_info(otp_release),
MinOtpVsn]);
- false ->
+ false ->
?ABORT("OTP release ~s or later is required, you have: ~s~n",
[MinOtpVsn,
erlang:system_info(otp_release)])
- end
+ end
end.
version_tuple(OtpRelease, Type) ->
- case re:run(OtpRelease, "R(\\d+)B?-?(\\d+)?", [{capture, all, list}]) of
+ case re:run(OtpRelease, "R(\\d+)B?-?(\\d+)?", [{capture, all, list}]) of
{match, [_Full, Maj, Min]} ->
{list_to_integer(Maj), list_to_integer(Min)};
{match, [_Full, Maj]} ->