forked from szermatt/turtles
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEldev
86 lines (73 loc) · 3.16 KB
/
Eldev
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
; -*- mode: emacs-lisp; lexical-binding: t -*-
(eldev-use-package-archive 'gnu-elpa)
(setq eldev-build-treat-warnings-as-errors t)
(setf eldev-project-loading-mode 'byte-compiled)
(setq sentence-end-double-space nil)
(eldev-use-plugin 'maintainer)
(setq eldev-release-test-local t)
(eldev-add-loading-roots 'test "test")
;; Exclude work and build files so Eldev doctor ignores them.
(setf eldev-standard-excludes
`(:or ,eldev-standard-excludes
"./license" "./docs/build" "./venv"))
;;; Documentation
(eldev-defbuilder turtles-builder-build-info (source target)
:short-name "SPHINX-TEXI"
:message source-and-target
:type many-to-one
:source-files "docs/source/*.rst"
:targets ("turtles.texi")
:collect ":default"
(turtles-eldev-build-texinfo))
(defun turtles-eldev-build-texinfo ()
(eldev-call-process "sphinx-build" '("-M" "texinfo" "docs/source" "docs/build")
:forward-output t
:die-on-error t)
;; Remove the date and version to keep the output stable from change
;; to change.
(with-temp-buffer
(insert-file-contents "docs/build/texinfo/turtles.texi")
(goto-char (point-min))
(search-forward-regexp "@\\*Generated by Sphinx [0-9.]+\\(snapshot\\)?\\.@\\*")
(replace-match "@*Generated by Sphinx.@*")
(goto-char (point-min))
(search-forward-regexp "@quotation\nTurtles [0-9.]+\\(snapshot\\)?\\(, .*\\)$")
(replace-match "@quotation\nTurtles")
(write-file "turtles.texi")))
(eldev-defcommand turtles-html-doc (&rest parameters)
"Generate documentation HTML into docs/build/html.
First install Sphinx with:
python3 -m venv venv
. venv/bin/activate
pip3 install -r docs/requirements.txt"
:command documentation
:aliases (html)
(eldev-call-process "sphinx-build" '("-M" "html" "docs/source" "docs/build")
:forward-output t
:die-on-error t))
(eldev-defcleaner turtles-cleaner-docs ()
"Delete Sphinx build dir"
:default t
'("docs/build"))
(defun turtles-release-preparator (version &optional post-release-version)
(eldev-with-file-buffer "docs/source/conf.py"
(dolist (tag '("version" "release"))
(goto-char (point-min))
(search-forward-regexp (concat tag " = '\\([0-9.]+\\(snapshot\\)?\\)' *$"))
(replace-match
(format "%s = '%s'" tag (package-version-join
(or post-release-version version))))))
(turtles-eldev-build-texinfo))
(add-hook 'eldev-release-preparators #'turtles-release-preparator)
;; After a release, add a snapshot to tag a development version, so if the
;; release is 1.0.0, the following development version is 1.0.1snapshot
;; and the next release is going to be 1.0.2 or 1.1.
(setq eldev-release-post-release-commit
(lambda (release-version)
(let ((major (or (nth 0 release-version) 0))
(minor (or (nth 1 release-version) 0))
(patch (or (nth 2 release-version) 0)))
(list major minor (1+ patch) -4))))
(setq eldev-release-post-release-commit-message
"Development version, following release @[version-string]@")
(add-hook 'eldev-release-post-release-preparators #'turtles-release-preparator)