Skip to content

Commit 973ba34

Browse files
committed
Introduce codenames for stable releases
1 parent cbd0666 commit 973ba34

File tree

4 files changed

+39
-10
lines changed

4 files changed

+39
-10
lines changed

cider-util.el

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,14 @@ Unless you specify a BUFFER it will default to the current one."
285285
(defvar cider-version)
286286

287287
(defun cider--version ()
288-
"Retrieve CIDER's version."
289-
(condition-case nil
290-
(pkg-info-version-info 'cider)
291-
(error cider-version)))
288+
"Retrieve CIDER's version.
289+
A codename is added to stable versions."
290+
(let ((version (condition-case nil
291+
(pkg-info-version-info 'cider)
292+
(error cider-version))))
293+
(if (string-match-p "-snapshot" cider-version)
294+
version
295+
(format "%s (%s)" version cider-codename))))
292296

293297

294298
;;; Strings

cider.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ project inference will take place."
9191
Normally it won't be used, unless `pkg-info' fails to extract the
9292
version from the CIDER package or library.")
9393

94+
(defconst cider-codename "Bulgaria"
95+
"Codename used to denote stable releases.")
96+
9497
(defcustom cider-lein-command
9598
"lein"
9699
"The command used to execute Leiningen."

test/cider-tests.el

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,18 @@
144144
(cider--nrepl-version () "0.2.12")
145145
(cider--connection-host (conn) "localhost")
146146
(cider--connection-port (conn) "54018"))
147-
(should (equal (cider-repl--banner)
148-
";; Connected to nREPL server running on port 54018 on host localhost - nrepl://localhost:54018
149-
;; CIDER 0.11.0, nREPL 0.2.12
147+
(let ((cider-version "0.11.0")
148+
(cider-codename "Victory"))
149+
(should (equal (cider-repl--banner)
150+
";; Connected to nREPL server running on port 54018 on host localhost - nrepl://localhost:54018
151+
;; CIDER 0.11.0 (Victory), nREPL 0.2.12
150152
;; Clojure 1.8.0, Java 1.8.0_31
151153
;; Docs: (doc function-name)
152154
;; (find-doc part-of-name)
153155
;; Source: (source function-name)
154156
;; Javadoc: (javadoc java-object-or-class)
155157
;; Exit: C-c C-q
156-
;; Results: Stored in vars *1, *2, *3, an exception in *e;"))))
158+
;; Results: Stored in vars *1, *2, *3, an exception in *e;")))))
157159

158160
(ert-deftest test-cider-repl--banner-version-fallback ()
159161
(noflet ((pkg-info-version-info (library) (error "No package version"))
@@ -162,10 +164,11 @@
162164
(cider--nrepl-version () "0.2.12")
163165
(cider--connection-host (conn) "localhost")
164166
(cider--connection-port (conn) "54018"))
165-
(let ((cider-version "0.11.0"))
167+
(let ((cider-version "0.11.0")
168+
(cider-codename "Victory"))
166169
(should (equal (cider-repl--banner)
167170
";; Connected to nREPL server running on port 54018 on host localhost - nrepl://localhost:54018
168-
;; CIDER 0.11.0, nREPL 0.2.12
171+
;; CIDER 0.11.0 (Victory), nREPL 0.2.12
169172
;; Clojure 1.8.0, Java 1.8.0_31
170173
;; Docs: (doc function-name)
171174
;; (find-doc part-of-name)

test/cider-util-tests.el

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(require 'cider)
22
(require 'cider-util)
33
(require 'ert)
4+
(require 'noflet)
45

56
;;; cider-util tests
67
(ert-deftest cider-symbol-at-point-dont-move ()
@@ -10,3 +11,21 @@
1011
(should (not (cider-symbol-at-point)))
1112
(should (equal "else" (cider-symbol-at-point 'lookback)))
1213
(should (= (point) (point-max)))))
14+
15+
(ert-deftest cider--version-fallback ()
16+
(noflet ((pkg-info-version-info (package) (error "No version")))
17+
(let ((cider-version "0.11.0")
18+
(cider-codename "Victory"))
19+
(should (string= (cider--version) "0.11.0 (Victory)")))))
20+
21+
(ert-deftest cider--version-stable-version ()
22+
(noflet ((pkg-info-version-info (package) "0.11.0"))
23+
(let ((cider-version "0.11.0")
24+
(cider-codename "Victory"))
25+
(should (string= (cider--version) "0.11.0 (Victory)")))))
26+
27+
(ert-deftest cider--version-snapshot-version ()
28+
(noflet ((pkg-info-version-info (package) "0.11.0snapshot (package: 20160301.2217)"))
29+
(let ((cider-version "0.11.0-snapshot")
30+
(cider-codename "Victory"))
31+
(should (string= (cider--version) "0.11.0snapshot (package: 20160301.2217)")))))

0 commit comments

Comments
 (0)