Skip to content

Commit 85a3333

Browse files
committed
Refactor a bit the version parsing
1 parent 6dd044f commit 85a3333

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/cider/nrepl/version.clj

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
;; namespace is used by every connection.
44
(:require [cider.nrepl.print-method]))
55

6+
;; TODO: Figure out how to read the version from project.clj to avoid duplication
7+
(def version-string
8+
"The current version for cider-nrepl as a string."
9+
"0.18.0-snapshot")
10+
611
(def version
7-
"Current version of CIDER nREPL, map of :major, :minor, :incremental, and :qualifier."
8-
(let [version-string "0.18.0-snapshot"]
9-
(assoc (->> version-string
10-
(re-find #"(\d+)\.(\d+)\.(\d+)-?(.*)")
11-
rest
12-
(zipmap [:major :minor :incremental :qualifier]))
13-
:version-string version-string)))
12+
"Current version of CIDER nREPL as a map.
13+
Map of :major, :minor, :incremental, and :qualifier."
14+
(assoc (->> version-string
15+
(re-find #"(\d+)\.(\d+)\.(\d+)-?(.*)")
16+
rest
17+
(zipmap [:major :minor :incremental :qualifier]))
18+
:version-string version-string))
1419

1520
(defn cider-version-reply
1621
"Returns CIDER-nREPL's version as a map which contains `:major`,

0 commit comments

Comments
 (0)