Remove doom-bootstrap system (will be replaced)

This commit is contained in:
Henrik Lissner 2017-05-20 10:23:22 +02:00
parent 39c3d6aae4
commit ce49f94bbe
9 changed files with 16 additions and 174 deletions

View file

@ -225,66 +225,5 @@ executed when called with `set!'. FORMS are not evaluated until `set!' calls it.
(when doom-debug-mode
(message "No setting found for %s" keyword)))))
;; Provides a means of installing external dependencies.
(defvar doom-bootstraps nil
"TODO")
(defmacro def-bootstrap! (name &rest forms)
"TODO"
(declare (indent defun))
(let ((prereqs (plist-get forms :requires)))
(while (keywordp (car forms))
(dotimes (i 2) (pop forms)))
`(push (cons ',name
(lambda ()
(cl-flet ((sh (lambda (&rest args) (apply #'doom-sh args)))
(sudo (lambda (&rest args) (apply #'doom-sudo args)))
(fetch (lambda (&rest args) (apply #'doom-fetch args)))
(message (lambda (&rest args)
(apply #'message (format "[%s] %s" ,(symbol-name name) (car args))
(cdr args)))))
(if (not ,(if (not prereqs)
't
(unless (listp prereqs)
(setq prereqs (list prereqs)))
`(and ,@(mapcar (lambda (sym) `(doom-bootstrap ',sym)) prereqs))))
(message "Aborting (prerequisites failed)")
(message "Bootstrapping")
,@forms
(message "Done")))))
doom-bootstraps)))
(defun doom-bootstrap (id)
(when-let (bootstrap (assq id doom-bootstraps))
(condition-case ex
(progn (funcall (cdr bootstrap)) t)
('error
(message "[%s] Aborted (ERROR: %s)"
id (if (eq (car ex) 'error) (cadr ex) ex))
nil))))
(defun doom/bootstrap (ids)
"Bootstraps a module, if it has a bootstrapper. Bootstraps are expected to be
recipes for setting up the external dependencies of a module by, for instance,
using the OS package manager to install them, or retrieving them from a repo
using `doom-fetch'."
(interactive
(list (list (completing-read "Bootstrap: " (mapcar #'car doom-bootstraps) nil t))))
(let (noninteractive)
(load "core.el" nil t))
(doom-initialize-packages t)
;; Error out if any of the bootstraps don't exist or aren't valid functions.
;; If something goes wrong, it's likely we don't want to continue.
(let ((err-not-found (cl-remove-if (lambda (id) (assq id doom-bootstraps)) ids))
(err-not-func (cl-remove-if (lambda (id) (functionp (cdr (assq id doom-bootstraps)))) ids))
(debug-on-error t))
(when (or (and err-not-found
(message "ERROR: These bootstraps don't exist: %s" err-not-found))
(and err-not-func
(message "ERROR: These bootstraps were invalid: %s" err-not-func)))
(error "There were errors. Aborting."))
(mapc #'doom-bootstrap ids)))
(provide 'core-lib)
;;; core-lib.el ends here