Skip to content

Commit

Permalink
Refactor a bit the version parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed May 20, 2018
1 parent 6dd044f commit 85a3333
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/cider/nrepl/version.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
;; namespace is used by every connection.
(:require [cider.nrepl.print-method]))

;; TODO: Figure out how to read the version from project.clj to avoid duplication
(def version-string
"The current version for cider-nrepl as a string."
"0.18.0-snapshot")

(def version
"Current version of CIDER nREPL, map of :major, :minor, :incremental, and :qualifier."
(let [version-string "0.18.0-snapshot"]
(assoc (->> version-string
(re-find #"(\d+)\.(\d+)\.(\d+)-?(.*)")
rest
(zipmap [:major :minor :incremental :qualifier]))
:version-string version-string)))
"Current version of CIDER nREPL as a map.
Map of :major, :minor, :incremental, and :qualifier."
(assoc (->> version-string
(re-find #"(\d+)\.(\d+)\.(\d+)-?(.*)")
rest
(zipmap [:major :minor :incremental :qualifier]))
:version-string version-string))

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

0 comments on commit 85a3333

Please sign in to comment.