0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 16:21:57 -05:00

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}
(string? version)
(let [[base build commit] (str/split version #"-" 3)]
{:full version
:base base
:build (d/parse-integer build)
:commit commit})
(if (re-seq #"^[A-Za-z]+\-" version)
(let [[branch base build commit] (str/split version #"-" 4)]
{:full version
:base base
: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))