Retrieve Erlang/OTP version like 18.1
.
- Erlang/OTP 17.0 or later
- (for development) rebar3
$ git clone https://github.com/sapporo-beam/erlang_version.git
$ cd erlang_version
$ rebar3 shell
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Eshell V7.1 (abort with ^G)
1> erlang_version:full().
<<"18.1">>
2> erlang_version:to_tuple().
{<<"18">>,<<"1">>,<<>>}
3> erlang_version:major().
<<"18">>
4> erlang_version:minor().
<<"1">>
5> erlang_version:patch().
<<>>
$ cat rebar.config
{erl_opts, [debug_info]}.
{deps, [
erlang_version
]}.
$ rebar3 shell
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Eshell V7.1 (abort with ^G)
1> erlang_version:to_tuple().
{<<"18">>,<<"1">>,<<>>}
$ cat mix.exs
(snip)
defp deps do
[{:erlang_version, "~> 0.2"}]
end
end
$ mix deps.get
$ iex -S mix
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.1.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :erlang_version.to_tuple
{"18", "1", ""}
The library is available as open source under the terms of the MIT License.