Versioning.Adapter.Semantic (Versioning v0.4.1) View Source
A versioning adapter for semantic-based versions.
Under the hood, this adapter uses the Version
module. For details on the rules
that are used for parsing and comparison, please see the Version
module.
Example
defmodule MyApp.Versioning do
use Versioning.Schema, adapter: Versioning.Adapter.Semantic
version "1.0.0" do
type "Post" do
change(MyApp.Change)
end
end
end
Link to this section Summary
Link to this section Functions
Specs
Compares semantic based versions.
Returns :gt
if the first verison is greater than the second, and :lt
for
vice-versa. If the two versions are equal, :eq
is returned. Returns :error
if the version cannot be parsed.
Example
iex> Versioning.Adapter.Semantic.compare("1.0.1", "1.0.0")
:gt
iex> Versioning.Adapter.Semantic.compare("1.0.0", "1.0.1)
:lt
iex> Versioning.Adapter.Semantic.compare("1.0.1", "1.0.1")
:eq
iex> Versioning.Adapter.Semantic.compare("foo", "bar")
:error
Specs
Parses semantic based versions.
Example
iex> Versioning.Adapter.Semantic.parse("1.0.0")
{:ok, #Version<1.0.0>}
iex> Versioning.Adapter.Semantic.parse("foo")
:error