dev(ci): deploy git hooks on 'doom install'

This commit is contained in:
Henrik Lissner 2021-10-09 19:41:30 +02:00
parent 3831096cfb
commit 3854c2fd70
2 changed files with 12 additions and 8 deletions

View file

@ -13,19 +13,20 @@
;;;
(defun doom-cli--ci-deploy-hooks ()
(defun doom-cli--ci-deploy-hooks (&optional noforce)
(let ((dir (doom-path doom-emacs-dir ".git/hooks"))
(default-directory doom-emacs-dir))
(make-directory dir 'parents)
(dolist (hook '("commit-msg" "pre-push"))
(let ((file (doom-path dir hook)))
(with-temp-file file
(insert "#!/usr/bin/env sh\n"
(doom-path doom-emacs-dir "bin/doom")
" --nocolor ci hook-" hook
" \"$@\""))
(set-file-modes file #o700)
(print! (success "Created %s") (relpath file))))))
(unless (and (file-exists-p file) noforce)
(with-temp-file file
(insert "#!/usr/bin/env sh\n"
(doom-path doom-emacs-dir "bin/doom")
" --nocolor ci hook-" hook
" \"$@\""))
(set-file-modes file #o700)
(print! (success "Created %s") (relpath file)))))))
;;

View file

@ -73,6 +73,9 @@ name. e.g.
(print! "Regenerating autoloads files")
(doom-autoloads-reload)
(print! "Deploying commit-msg and pre-push git hooks")
(doom-cli--ci-deploy-hooks)
(cond (nofonts-p)
(IS-WINDOWS
(print! (warn "Doom cannot install all-the-icons' fonts on Windows!\n"))