-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsb-stats.asd
122 lines (98 loc) · 4.08 KB
/
rsb-stats.asd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
;;;; rsb-stats.asd --- Stats functions for rsb-based utilities.
;;;;
;;;; Copyright (C) 2011-2019 Jan Moringen
;;;;
;;;; Author: Jan Moringen <[email protected]>
(cl:defpackage #:rsb-stats-system
(:use
#:cl
#:asdf)
(:export
#:version/list
#:version/string))
(cl:in-package #:rsb-stats-system)
;;; Version stuff
(defparameter +version-major+ 0
"Major component of version number.")
(defparameter +version-minor+ 19
"Minor component of version number.")
(let* ((version-file (merge-pathnames "version.sexp" *load-truename*))
stream)
(when (probe-file version-file)
(setf stream (open version-file)))
(defparameter +version-revision+ (if stream (read stream) 0)
"Revision component of version number.")
(defparameter +version-commit+ (when stream (read stream))
"Commit component of version number.")
(when stream (close stream)))
(defun version/list (&key
(revision? t)
commit?)
"Return a version of the form (MAJOR MINOR [REVISION [COMMIT]])
where REVISION and COMMIT are optional.
REVISION? controls whether REVISION should be included. Default
behavior is to include REVISION.
COMMIT? controls whether COMMIT should be included. Default behavior
is to not include COMMIT."
(append (list +version-major+ +version-minor+)
(when revision? (list +version-revision+))
(when (and commit? +version-commit+)
(list +version-commit+))))
(defun version/string (&rest args
&key
revision?
commit?)
"Return a version string of the form
\"MAJOR.MINOR[.REVISION[-.COMMIT]]\" where REVISION and COMMIT are
optional.
See `version/list' for details on keyword parameters."
(declare (ignore revision? commit?))
(format nil "~{~A.~A~^.~A~^-~A~}" (apply #'version/list args)))
;;; System definition
(defsystem :rsb-stats
:author "Jan Moringen <[email protected]>"
:maintainer "Jan Moringen <[email protected]>"
:version #.(version/string)
:license "GPLv3" ; see COPYING file for details.
:description "This system provides some stats functions for
RSB-related systems."
:depends-on (:alexandria
:let-plus
:more-conditions
(:version :architecture.service-provider "0.1")
:local-time
(:version :rsb #.(version/string :revision? nil)))
:encoding :utf-8
:components ((:module "stats"
:pathname "src/stats"
:serial t
:components ((:file "package")
(:file "types")
(:file "conditions")
(:file "protocol")
(:file "util")
(:file "quantity-mixins")
(:file "quantities"))))
:in-order-to ((test-op (test-op :rsb-stats/test))))
;;; System definition for test of the rsb-stats system
(defsystem :rsb-stats/test
:author "Jan Moringen <[email protected]>"
:maintainer "Jan Moringen <[email protected]>"
:version #.(version/string)
:license "GPLv3" ; see COPYING file for details.
:description "This system contains tests for the rsb-stats system."
:depends-on ((:version :lift "1.7.1")
:cl-ppcre
(:version :rsb-stats #.(version/string)))
:encoding :utf-8
:components ((:module "stats"
:pathname "test/stats"
:serial t
:components ((:file "package")
(:file "protocol")
(:file "quantities")))))
(defmethod perform ((operation test-op)
(component (eql (find-system :rsb-stats/test))))
(funcall (find-symbol "RUN-TESTS" :lift)
:config (funcall (find-symbol "LIFT-RELATIVE-PATHNAME" :lift)
"lift-rsb-stats.config")))