Implement bootstrap functionality + make bootstrap (WIP)

This commit is contained in:
Henrik Lissner 2017-03-20 02:45:31 -04:00
parent de08d0a2db
commit 804aba93f5
7 changed files with 131 additions and 24 deletions

View file

@ -8,3 +8,29 @@
(when (featurep! :completion company)
(package! company-go))
;;
(def-bootstrap! go
(let ((gobin (executable-find "go"))
(gopath (getenv "GOPATH"))
changed)
(unless gobin
(pcase (doom-system-os)
('arch
(sudo "pacman --noconfirm -S go"))
('debian) ;; TODO
('macos
(sh "brew install go")))
(unless (executable-find "go")
(error "Go isn't installed (%s)" gobin)))
(unless (file-directory-p gopath)
(error "GOPATH isn't set up (%s)" gopath))
(mapc (lambda (url)
(unless (file-directory-p (expand-file-name (concat "src/" url) gopath))
(sh "%s get -u '%s'" gobin url)
(setq changed t)))
'("github.com/nsf/gocode"
"github.com/motemen/gore"
"golang.org/x/tools/cmd/guru"
"golang.org/x/tools/cmd/gorename"))
(or changed (not gobin))))

View file

@ -14,3 +14,23 @@
(when (featurep! :feature jump)
(package! xref-js2))
;;
(def-bootstrap! javascript
(unless (cl-every 'executable-find '("node" "npm" "tern"))
(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"))))
(unless (executable-find "node")
(error "Failed to install NodeJS"))
(unless (executable-find "tern")
(funcall (if (file-writable-p (executable-find "npm")) 'sh 'sudo)
"npm -g install tern"))
t))

View file

@ -1,14 +0,0 @@
;;; lang/sh/boostrap.el
(bootstrap!
:title "{z,ba}sh"
:desc "Sets up the zshdb and bashdb debuggers, and shell-check"
:if-debian
(sudo "apt-get update && apt-get install zshdb bashdb spellcheck")
:if-arch
(sudo "pacman --noconfirm --needed -S zshdb bashdb shellcheck")
:if-macos
(sh "brew install zshdb bashdb"))

View file

@ -3,3 +3,16 @@
(when (featurep! :completion company)
(package! company-shell))
;;
(def-bootstrap! sh
(when-let (progs (cl-remove-if 'executable-find '("zshdb" "bashdb" "shellcheck")))
(let ((prog-str (string-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))))
t))