Add :requires prop to def-bootstrap! & refactor+rewrite bootstrapping

This commit is contained in:
Henrik Lissner 2017-03-25 18:41:29 -04:00
parent 71dbf605ae
commit 72698ca9e8
9 changed files with 84 additions and 55 deletions

View file

@ -56,5 +56,4 @@
(when IS-MAC
(sh (format "install_name_tool -change @rpath/libclang.dylib %s %s"
"/usr/local/opt/llvm/lib/libclang.dylib"
(expand-file-name "bin/irony-server" irony-server-install-prefix)))))
t))
(expand-file-name "bin/irony-server" irony-server-install-prefix)))))))

View file

@ -32,5 +32,4 @@
'("github.com/nsf/gocode"
"github.com/motemen/gore"
"golang.org/x/tools/cmd/guru"
"golang.org/x/tools/cmd/gorename"))
(or changed (not gobin))))
"golang.org/x/tools/cmd/gorename"))))

View file

@ -17,25 +17,27 @@
(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
(unless (cl-every 'executable-find '("node" "npm" "tern" "js-beautify" "eslint"))
(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")
(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"))
t))
: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

@ -20,5 +20,4 @@
(when-let (pkgs (cl-remove-if
(lambda (pkg) (zerop (shell-command (format "pip show %s" pkg))))
'("jedi" "setuptools")))
(sh "pip install %s" (s-join " " pkgs))
t))
(sh "pip install jedi setuptools")))

View file

@ -8,3 +8,15 @@
(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)))

View file

@ -23,19 +23,16 @@
('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)
(and (unless (file-directory-p racer-rust-src-path)
(fetch :github "rust-lang/rust" (expand-file-name "rust" +rust-ext-dir))
t)
(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"))
t))))
(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

@ -14,5 +14,4 @@
('debian
(sudo "apt-get install -y %s" prog-str))
('macos
(sh "brew install %s" prog-str))))
t))
(sh "brew install %s" prog-str))))))

View file

@ -18,3 +18,10 @@
(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")))