-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathEldev
63 lines (54 loc) · 2.28 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
; -*- mode: emacs-lisp; lexical-binding: t -*-
;; Uncomment some calls below as needed for your project.
;(eldev-use-package-archive 'gnu-elpa)
;(eldev-use-package-archive 'nongnu-elpa)
;(eldev-use-package-archive 'melpa)
(eldev-use-plugin 'autoloads)
(eldev-use-plugin 'undercover)
(eldev-defcommand tag (tag)
"Make a new tag"
:parameters "TAG"
(unless tag
(signal 'eldev-wrong-command-usage))
(let ((name "syncthing.el")
(buff (get-buffer-create "*output*")))
(when (< 0 (call-process "git" nil buff nil "add" "-f" "."))
(eldev-output (with-current-buffer buff (buffer-string)))
(error "Failed to add files"))
(when (< 0 (call-process "git" nil buff nil "stash"))
(eldev-output (with-current-buffer buff (buffer-string)))
(error "Failed to stash files"))
(with-temp-buffer
(insert-file-contents name)
(goto-char (point-min))
(re-search-forward tag))
(when (< 0 (call-process "git" nil buff nil "tag" tag "--sign"))
(eldev-output (with-current-buffer buff (buffer-string)))
(error "Failed to tag and sign"))))
(defsubst eval-in-client (name script)
(unless (consp script)
(user-error "Invalid script: %s" script))
(let ((client (or (getenv "EMACSCLIENT") "emacsclient"))
(sock (or (getenv "EMACS_SOCKET_NAME") "/run/user/1000/emacs/server")))
(unless (executable-find client)
(error "Emacsclient not found"))
(start-process name nil client "--socket-name" sock "--eval"
(format "%S" script))))
(eldev-defcommand demo ()
"Run demo"
(let* ((host (or (getenv "DEMO_HOST") "127.0.0.1"))
(port (or (getenv "DEMO_PORT") "5000"))
(proto "http")
(demo-addr (format "%s://%s:%s" proto host port))
(data-dir (or (getenv "DEMO_DATA") default-directory))
(server-name "syncthing-demo-server"))
(eval-in-client "syncthing-demo"
`(progn (load-file "demo/demo.el")
(syncthing-demo "Demo" ,demo-addr)))
(let ((process-environment
(append process-environment
`(,(format "DEMO_HOST=%s" host)
,(format "DEMO_PORT=%s" port)
,(format "DEMO_DATA=%s" data-dir)))))
(load-file "demo/demo-server.el"))
(while t (sit-for 1))))