mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 16:30:37 -05:00
✨ Minor improvements on version decoding ns.
This commit is contained in:
parent
3cb9470db2
commit
605143ef7e
1 changed files with 23 additions and 8 deletions
|
@ -13,27 +13,42 @@
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[cuerdas.core :as str]))
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
(def version-re #"^(([A-Za-z]+)\-?)?(\d+\.\d+\.\d+)(\-?((alpha|prealpha|beta|rc)(\d+)?))?(\-?(\d+))?(\-?(\w+))$")
|
(def version-re #"^(([A-Za-z]+)\-?)?((\d+)\.(\d+)\.(\d+))(\-?((alpha|prealpha|beta|rc|dev)(\d+)?))?(\-?(\d+))?(\-?g(\w+))$")
|
||||||
|
|
||||||
(defn parse
|
(defn parse
|
||||||
[data]
|
[data]
|
||||||
(cond
|
(cond
|
||||||
(= data "%version%")
|
(= data "%version%")
|
||||||
{:full "develop"
|
{:full "develop"
|
||||||
:base "develop"
|
|
||||||
:branch "develop"
|
:branch "develop"
|
||||||
|
:base "0.0.0"
|
||||||
|
:main "0.0"
|
||||||
|
:major "0"
|
||||||
|
:minor "0"
|
||||||
|
:patch "0"
|
||||||
:modifier nil
|
:modifier nil
|
||||||
:commit nil
|
:commit nil
|
||||||
:commit-hash nil}
|
:commit-hash nil}
|
||||||
|
|
||||||
(string? data)
|
(string? data)
|
||||||
(let [result (re-find version-re data)]
|
(let [result (re-find version-re data)
|
||||||
|
major (get result 4)
|
||||||
|
minor (get result 5)
|
||||||
|
patch (get result 6)
|
||||||
|
base (get result 3)
|
||||||
|
main (str/fmt "%s.%s" major minor)
|
||||||
|
branch (get result 2)]
|
||||||
|
|
||||||
{:full data
|
{:full data
|
||||||
:base (get result 3)
|
:base base
|
||||||
:branch (get result 2)
|
:main main
|
||||||
:modifier (get result 5)
|
:major major
|
||||||
:commit (get result 9)
|
:minor minor
|
||||||
:commit-hash (get result 11)})
|
:patch patch
|
||||||
|
:branch branch
|
||||||
|
:modifier (get result 8)
|
||||||
|
:commit (get result 12)
|
||||||
|
:commit-hash (get result 14)})
|
||||||
|
|
||||||
:else nil))
|
:else nil))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue