View Source BeamMeta.Compatibility.OtpElixir (BeamMeta v0.1.0)
Compatibility between Erlang/OTP and Elixir.
Main documentation page: Compatibility between Elixir and Erlang/OTP
Link to this section Summary
Functions
Determines whether the given Elang/OTP and Elixir versions are compatible.
Returns a list of all the Elixir releases available for the given Erlang/OTP version.
Returns a list of all the Erlang/OTP releases available for the givien Elixir version.
Returns a map with the compatibility table.
Link to this section Types
Specs
elixir_version() :: BeamMeta.elixir_version_key() | BeamMeta.elixir_version_representation()
Represents an Elixir version.
It could be:
- a string in the shape of
"MAJOR.MINOR"
, for example:"1.13"
; - a
Version.t/0
or string representation of this one, for example:#Version<1.13.0>
or"1.13.0"
.
Specs
otp_version() :: BeamMeta.otp_version_key() | BeamMeta.otp_version_representation()
Represents an Erlang/OTP version.
It could be:
- an integer that represents the Erlang/OTP major version, for example:
24
. - a
Version.t/0
or string representation of this one, for example:#Version<24.0.0>
or"24.0.0"
.
Link to this section Functions
Specs
compatible?(otp_version(), elixir_version()) :: boolean()
Determines whether the given Elang/OTP and Elixir versions are compatible.
The results are based on the compatibility table. This function does not check that the Elixir and Erlang/OTP actually exists.
elixir_version
can be a Version.t/0
or a string.
otp_version
can be a Version.t/0
, a string or an integer.
BeamMeta.Compatibility.OtpElixir.compatible?("1.11.999", 24)
will return true
since
Elixir v1.11 is compatible with OTP 24. If you want to make sure the Elixir
version actually exist, please use the guards
BeamMeta.Release.is_elixir_version/1
. For example:
iex> require BeamMeta.Release
...> elixir_version = "1.11.999"
...> BeamMeta.Release.is_elixir_version(elixir_version) and BeamMeta.Compatibility.OtpElixir.compatible?(24, elixir_version)
false
Examples
iex> BeamMeta.Compatibility.OtpElixir.compatible?(24, "1.13")
true
iex> BeamMeta.Compatibility.OtpElixir.compatible?(24, "1.11")
false
iex> BeamMeta.Compatibility.OtpElixir.compatible?(24, "1.11.4")
true
iex> BeamMeta.Compatibility.OtpElixir.compatible?(24, "1.11.999")
true
Specs
elixir_releases( otp_version(), return_type :: :key | :version | :version_requirement ) :: [ BeamMeta.elixir_version_key() | Version.t() | Version.Requirement.t() ]
Returns a list of all the Elixir releases available for the given Erlang/OTP version.
otp_version
can be a Version.t/0
, a string, or an integer.
return_type
determines the type of values returned. These could be:
:key
: The string by which the Elixir version is identified. Ex: "1.12". This is the default value is not value is provided.:version
: The Elixir version inVersion.t/0
format.:version_requirement
: The Elixir versions int:Version.Required.t/0
format.
The results are sorted ascendenly.
Examples
iex> BeamMeta.Compatibility.OtpElixir.elixir_releases(21)
["1.6", "1.7", "1.8", "1.9", "1.10", "1.10.3", "1.11", "1.11.4"]
iex> BeamMeta.Compatibility.OtpElixir.elixir_releases("17.1", :key)
["1.0", "1.0.5", "1.1"]
> BeamMeta.Compatibility.OtpElixir.elixir_releases("17.1", :version)
[#Version<1.0.0>, #Version<1.0.5>, #Version<1.1.0>]
> BeamMeta.Compatibility.OtpElixir.elixir_releases("17.1", :version_requirement)
[#Version.Requirement<~> 1.0.0>, #Version.Requirement<~> 1.0.5-0>, #Version.Requirement<~> 1.1.0-0>]
iex> BeamMeta.Compatibility.OtpElixir.elixir_releases(16)
[]
Specs
otp_releases( elixir_version(), return_type :: :key | :version | :version_requirement ) :: [ BeamMeta.otp_version_key() | Version.t() | Version.Requirement.t() ]
Returns a list of all the Erlang/OTP releases available for the givien Elixir version.
elixir_version
can be a Version.t/0
or a string.
return_type
determines the type of values returned. These could be:
:key
: The string by which the Elixir version is identified. This is the default value if no return type is provided.:version
: The Elixir version inVersion.t/0
format.:version_requirement
: The Elixir versions int:Version.Required.t/0
format.
The results are sorted ascendenly.
Examples
# MAJOR.MINOR
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11")
[21, 22, 23]
# MAJOR.MINOR.PATCH
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11.0")
[21, 22, 23]
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11.2")
[21, 22, 23]
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11.4")
[21, 22, 23, 24]
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11.4", :key)
[21, 22, 23, 24]
> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11.4", :version)
[#Version<21.0.0>, #Version<22.0.0>, #Version<23.0.0>, #Version<24.0.0>]
> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11.4", :version_requirement)
[#Version.Requirement<~> 21.0>, #Version.Requirement<~> 22.0>, #Version.Requirement<~> 23.0>, #Version.Requirement<~> 24.0>]
# Version do not necessarily need to exist.
# The results are based on the compaibility table
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("1.11.999")
[21, 22, 23, 24]
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("1.99.0")
[]
iex> BeamMeta.Compatibility.OtpElixir.otp_releases("2.0")
[]
Specs
table({:elixir, :otp}) :: %{ required(BeamMeta.elixir_version_key()) => %{ otp_versions: %{ required(BeamMeta.otp_version_key()) => %{ version: Version.t(), version_requirement: Version.Requirement.t() } }, version: Version.t(), version_requirement: Version.Requirement.t() } }
table({:otp, :elixir}) :: %{ required(BeamMeta.otp_version_key()) => %{ elixir_versions: %{ required(BeamMeta.elixir_version_key()) => %{ version: Version.t(), version_requirement: Version.Requirement.t() } }, version: Version.t(), version_requirement: Version.Requirement.t() } }
Returns a map with the compatibility table.
Note that this is not a table that contains every release, but a table that represent the MAJOR.MINOR and eventually the MAJOR.MINOR.PATCH releases listed in the page Compatibility between Elixir and Erlang/OTP
Examples
> BeamMeta.Compatibility.OtpElixir.table({:otp, :elixir})
%{
17 => %{
elixir_versions: %{
"1.0" => %{
version: #Version<1.0.0>,
version_requirement: #Version.Requirement<~> 1.0.0>
},
"1.1" => %{
version: #Version<1.1.0>,
version_requirement: #Version.Requirement<~> 1.1.0>
}
},
version: #Version<17.0.0>,
version_requirement: #Version.Requirement<~> 17.0.0-0>
},
18 => %{
elixir_versions: %{
"1.0.5" => %{
version: #Version<1.0.5>,
version_requirement: #Version.Requirement<~> 1.0.5>
},
"1.1" => %{...},
"1.2" => %{...},
"1.3" => %{...},
"1.4" => %{...},
"1.5" => %{...}
},
version: #Version<18.0.0>,
version_requirement: #Version.Requirement<~> 18.0.0-0>
},
...
%}
> BeamMeta.Compatibility.OtpElixir.table({:elixir, :otp})
%{
"1.0" => %{
otp_versions: %{
17 => %{
version: #Version<17.0.0>,
version_requirement: #Version.Requirement<~> 17.0>
}
},
version: #Version<1.0.0>,
version_requirement: #Version.Requirement<~> 1.0.0>
},
"1.0.5" => %{...},
"1.1" => %{
otp_versions: %{
17 => %{...},
18 => %{...}
},
version: #Version<1.1.0>,
version_requirement: #Version.Requirement<~> 1.1.0-0>
},
...
}