From ce49f94bbefc11b6c37aaf8a7f9d51bb8f90d786 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 20 May 2017 10:23:22 +0200 Subject: [PATCH] Remove doom-bootstrap system (will be replaced) --- Makefile | 2 +- core/core-lib.el | 61 ----------------------------- modules/lang/haskell/packages.el | 18 +-------- modules/lang/javascript/packages.el | 27 +------------ modules/lang/python/packages.el | 16 +------- modules/lang/ruby/packages.el | 13 +----- modules/lang/rust/packages.el | 29 +------------- modules/lang/sh/packages.el | 15 ++----- modules/lang/web/packages.el | 9 +---- 9 files changed, 16 insertions(+), 174 deletions(-) diff --git a/Makefile b/Makefile index af49db721..cc12ca242 100644 --- a/Makefile +++ b/Makefile @@ -48,4 +48,4 @@ init.el: @$(EMACS) -f 'doom-initialize-autoloads' -.PHONY: all test bootstrap +.PHONY: all test diff --git a/core/core-lib.el b/core/core-lib.el index c5abda0fb..824170181 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -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 diff --git a/modules/lang/haskell/packages.el b/modules/lang/haskell/packages.el index 564b0f7d8..14810b2ff 100644 --- a/modules/lang/haskell/packages.el +++ b/modules/lang/haskell/packages.el @@ -1,21 +1,7 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/haskell/packages.el +;; requires haskell cabal-install ghz happy alex + (package! haskell-mode) (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"))))) diff --git a/modules/lang/javascript/packages.el b/modules/lang/javascript/packages.el index 6079601b1..5d9b56cbd 100644 --- a/modules/lang/javascript/packages.el +++ b/modules/lang/javascript/packages.el @@ -1,6 +1,8 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/javascript/packages.el +;; requires node npm tern js-beautify eslint eslint-plugin-react + (package! coffee-mode) (package! js2-mode) (package! js2-refactor) @@ -16,28 +18,3 @@ (when (featurep! :feature jump) (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"))) diff --git a/modules/lang/python/packages.el b/modules/lang/python/packages.el index 42db3a7bc..8ed17820e 100644 --- a/modules/lang/python/packages.el +++ b/modules/lang/python/packages.el @@ -1,23 +1,11 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/python/packages.el +;; requires: python jedi setuptools + (package! anaconda-mode) (package! nose) (package! pip-requirements) (when (featurep! :completion company) (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"))) diff --git a/modules/lang/ruby/packages.el b/modules/lang/ruby/packages.el index 1d72cfc56..97353a6cf 100644 --- a/modules/lang/ruby/packages.el +++ b/modules/lang/ruby/packages.el @@ -1,6 +1,8 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/ruby/packages.el +;; requires ruby ruby-lint + (package! inf-ruby) (package! rspec-mode) (package! ruby-refactor) @@ -9,14 +11,3 @@ (when (featurep! :completion company) (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))) diff --git a/modules/lang/rust/packages.el b/modules/lang/rust/packages.el index b192a40d4..cf4244060 100644 --- a/modules/lang/rust/packages.el +++ b/modules/lang/rust/packages.el @@ -1,6 +1,8 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/rust/packages.el +;; requires rust cargo racer + (package! racer) (package! rust-mode) @@ -9,30 +11,3 @@ (when (featurep! :completion company) (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"))))) diff --git a/modules/lang/sh/packages.el b/modules/lang/sh/packages.el index 95c9f4700..11f456485 100644 --- a/modules/lang/sh/packages.el +++ b/modules/lang/sh/packages.el @@ -1,17 +1,8 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/sh/packages.el +;; requires shellcheck +;; optional: zshdb bashdb + (when (featurep! :completion company) (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)))))) diff --git a/modules/lang/web/packages.el b/modules/lang/web/packages.el index c707827a2..1d4c28811 100644 --- a/modules/lang/web/packages.el +++ b/modules/lang/web/packages.el @@ -1,6 +1,8 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/web/packages.el +;; requires js-beautify stylelint stylelint-scss + (package! rainbow-mode) (package! web-beautify) (when (featurep! :completion ivy) @@ -18,10 +20,3 @@ (package! sass-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")))