Improve version parsing.

This commit is contained in:
Andrey Antukh 2021-01-19 16:28:53 +01:00
parent ef25f8a721
commit 4e43bf5f78

View file

@ -23,10 +23,18 @@
:commit nil} :commit nil}
(string? version) (string? version)
(let [[base build commit] (str/split version #"-" 3)] (if (re-seq #"^[A-Za-z]+\-" version)
{:full version (let [[branch base build commit] (str/split version #"-" 4)]
:base base {:full version
:build (d/parse-integer build) :base base
:commit commit}) :build (d/parse-integer build)
:branch branch
:commit commit})
(let [[base build commit] (str/split version #"-" 3)]
{:full version
:base base
:build (d/parse-integer build)
:branch nil
:commit commit}))
:else nil)) :else nil))