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

@ -48,4 +48,4 @@ init.el:
@$(EMACS) -f 'doom-initialize-autoloads' @$(EMACS) -f 'doom-initialize-autoloads'
.PHONY: all test bootstrap .PHONY: all test

View file

@ -225,66 +225,5 @@ executed when called with `set!'. FORMS are not evaluated until `set!' calls it.
(when doom-debug-mode (when doom-debug-mode
(message "No setting found for %s" keyword))))) (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) (provide 'core-lib)
;;; core-lib.el ends here ;;; core-lib.el ends here

View file

@ -1,21 +1,7 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/haskell/packages.el ;;; lang/haskell/packages.el
;; requires haskell cabal-install ghz happy alex
(package! haskell-mode) (package! haskell-mode)
(package! dante) (package! dante)
;;
(def-bootstrap! haskell
(pcase (doom-system-os)
('arch
(let ((pkgs (cl-remove-if 'executable-find '("ghc" "happy" "alex"))))
(unless (executable-find "cabal")
(push "cabal-install" pkgs))
(when pkgs
(sudo "pacman --noconfirm -S %s" (s-join " " pkgs)))))
('debian) ;; TODO
('macos
(unless (executable-find "ghc")
(sh "brew install ghc"))
(unless (executable-find "cabal")
(sh "brew install cabal-install")))))

View file

@ -1,6 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/javascript/packages.el ;;; lang/javascript/packages.el
;; requires node npm tern js-beautify eslint eslint-plugin-react
(package! coffee-mode) (package! coffee-mode)
(package! js2-mode) (package! js2-mode)
(package! js2-refactor) (package! js2-refactor)
@ -16,28 +18,3 @@
(when (featurep! :feature jump) (when (featurep! :feature jump)
(package! xref-js2)) (package! xref-js2))
;;
(def-bootstrap! nodejs
(pcase (doom-system-os)
('arch
(let (progs)
(unless (executable-find "node") (push "nodejs" progs))
(unless (executable-find "npm") (push "npm" progs))
(when progs
(sudo "pacman --noconfirm -S %s" progs))))
('debian) ;; TODO
('macos
(unless (executable-find "node")
(sh "brew install node"))))
;; return success
(unless (cl-every 'executable-find '("node" "npm"))
(error "Something went wrong installing NodeJS")))
(def-bootstrap! javascript
:requires nodejs
(unless (executable-find "tern")
(sh "npm -g install tern"))
(unless (executable-find "js-beautify")
(sh "npm -g install js-beautify"))
(unless (executable-find "eslint")
(sh "npm -g install eslint eslint-plugin-react")))

View file

@ -1,23 +1,11 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/python/packages.el ;;; lang/python/packages.el
;; requires: python jedi setuptools
(package! anaconda-mode) (package! anaconda-mode)
(package! nose) (package! nose)
(package! pip-requirements) (package! pip-requirements)
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-anaconda)) (package! company-anaconda))
;;
(def-bootstrap! python
;; Since there are so many possible setups for a python environment (pyenv,
;; virtualenv, etc), I'll leave it to you and only take care of installing
;; dependencies available via pip.
(unless (executable-find "python")
(error "python isn't installed"))
(unless (executable-find "pip")
(error "pip isn't installed"))
(when-let (pkgs (cl-remove-if
(lambda (pkg) (zerop (shell-command (format "pip show %s" pkg))))
'("jedi" "setuptools")))
(sh "pip install jedi setuptools")))

View file

@ -1,6 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/ruby/packages.el ;;; lang/ruby/packages.el
;; requires ruby ruby-lint
(package! inf-ruby) (package! inf-ruby)
(package! rspec-mode) (package! rspec-mode)
(package! ruby-refactor) (package! ruby-refactor)
@ -9,14 +11,3 @@
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-inf-ruby)) (package! company-inf-ruby))
;;
(def-bootstrap! ruby
;; Since there are so many possible setups for a ruby environment (rbenv, rvm,
;; etc), I'll leave it to you and only take care of installing gem
;; dependencies.
(unless (executable-find "ruby")
(error "ruby isn't installed"))
(unless (executable-find "gem")
(error "gem isn't installed"))
(when-let (pkgs (cl-remove-if 'executable-find) '("ruby-lint")))
(sh "gem install %s" (s-join " " pkgs)))

View file

@ -1,6 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/rust/packages.el ;;; lang/rust/packages.el
;; requires rust cargo racer
(package! racer) (package! racer)
(package! rust-mode) (package! rust-mode)
@ -9,30 +11,3 @@
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-racer)) (package! company-racer))
;;
(def-bootstrap! rust
(pcase (doom-system-os)
('arch
(let (pkgs)
(unless (executable-find "rustc") (push "rust" pkgs))
(unless (executable-find "cargo") (push "cargo" pkgs))
(when pkgs
(sudo "pacman --noconfirm -S %s" (s-join " " pkgs)))))
('debian) ;; TODO
('macos
(unless (executable-find "rustc")
(sh "brew install rust"))))
(dolist (bin '("rustc" "cargo"))
(unless (executable-find bin)
(error "Failed to install %s" bin)))
(require! :lang rust t)
(require 'racer)
(unless (file-directory-p racer-rust-src-path)
(fetch :github "rust-lang/rust" (expand-file-name "rust" +rust-ext-dir)))
(unless (file-executable-p racer-cmd)
(let ((racer-dir (expand-file-name "racer" +rust-ext-dir)))
(fetch :github "phildawes/racer" racer-dir)
(let ((default-directory racer-dir))
(sh "cargo build --release")))))

View file

@ -1,17 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/sh/packages.el ;;; lang/sh/packages.el
;; requires shellcheck
;; optional: zshdb bashdb
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-shell)) (package! company-shell))
;;
(def-bootstrap! sh
(when-let (progs (cl-remove-if 'executable-find '("zshdb" "bashdb" "shellcheck")))
(let ((prog-str (s-join " " progs)))
(pcase (doom-system-os)
('arch
(sudo "pacman --noconfirm -S %s" prog-str))
('debian
(sudo "apt-get install -y %s" prog-str))
('macos
(sh "brew install %s" prog-str))))))

View file

@ -1,6 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/web/packages.el ;;; lang/web/packages.el
;; requires js-beautify stylelint stylelint-scss
(package! rainbow-mode) (package! rainbow-mode)
(package! web-beautify) (package! web-beautify)
(when (featurep! :completion ivy) (when (featurep! :completion ivy)
@ -18,10 +20,3 @@
(package! sass-mode) (package! sass-mode)
(package! stylus-mode) (package! stylus-mode)
;;
(def-bootstrap! web
:requires nodejs
(unless (executable-find "js-beautify")
(sh "npm -g install js-beautify"))
(unless (executable-find "stylelint")
(sh "npm -g install stylelint stylelint-scss")))