25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

mix.exs: Be more careful while editing the version

Make sure only leading zeroes are removed while turning the ejabberd
version into SemVer format for Mix.  For example, remove the zero in
"21.04", but keep the zero in "21.12.102".
This commit is contained in:
Holger Weiss 2022-02-21 00:02:31 +01:00
parent a6f0feb23b
commit da516d64d4

View File

@ -26,9 +26,9 @@ defmodule Ejabberd.MixProject do
'0.0' -> "0.0.0" # the full git repository wasn't downloaded
'latest.0' -> "0.0.0" # running 'docker-ejabberd/ecs/build.sh latest'
[_, _, ?., _, _] = x ->
head = String.replace(:erlang.list_to_binary(x), ~r/0+([0-9])/, "\\1")
head = String.replace(:erlang.list_to_binary(x), ~r/\.0+([0-9])/, ".\\1")
<<head::binary, ".0">>
vsn -> String.replace(:erlang.list_to_binary(vsn), ~r/0+([0-9])/, "\\1")
vsn -> String.replace(:erlang.list_to_binary(vsn), ~r/\.0+([0-9])/, ".\\1")
end
end