core-cli: backport more refactors from rewrite
Still a long way to go, but this introduces a few niceties for debugging CLI failures: + The (extended) output of the last bin/doom command is now logged to ~/.emacs.d/.local/doom.log + If an error occurs, short backtraces are displayed whether or not you have debug mode on. The full backtrace is written to ~/.emacs.d/.local/doom.error.log. + bin/doom now aborts with a warning if: - The script itself or its parent directory is a symlink. It's fine if ~/.emacs.d is symlinked though. - Running bin/doom as root when your DOOMDIR isn't in /root/. - If you're sporting Emacs 26.1 (now handled in the elisp side rather than the /bin/sh shebang preamble). + If a 'doom sync' was aborted prematurely, you'll be warned that Doom was left in an inconsistent state and that you must run `doom sync` again. May address #3746
This commit is contained in:
parent
7e362e8fbd
commit
e632871a11
11 changed files with 393 additions and 242 deletions
|
@ -28,7 +28,7 @@
|
|||
(spy-on 'doom-initialize-packages :and-return-value t))
|
||||
|
||||
(it "initializes packages if core autoload file doesn't exist"
|
||||
(let ((doom-autoload-file "doesnotexist"))
|
||||
(let ((doom-autoloads-file "doesnotexist"))
|
||||
(expect (doom-initialize nil 'noerror))
|
||||
(expect 'doom-initialize-packages :to-have-been-called))
|
||||
|
||||
|
@ -51,12 +51,12 @@
|
|||
(it "loads autoloads files"
|
||||
(ignore-errors (doom-initialize nil 'noerror))
|
||||
(expect 'doom-load-autoloads-file
|
||||
:to-have-been-called-with doom-autoload-file)
|
||||
:to-have-been-called-with doom-autoloads-file)
|
||||
(expect 'doom-load-autoloads-file
|
||||
:to-have-been-called-with doom-package-autoload-file))
|
||||
|
||||
(it "throws doom-autoload-error when autoload files don't exist"
|
||||
(let ((doom-autoload-file "doesnotexist")
|
||||
(let ((doom-autoloads-file "doesnotexist")
|
||||
(doom-package-autoload-file "doesnotexist"))
|
||||
(expect (doom-initialize) :to-throw 'doom-autoload-error)))))
|
||||
|
||||
|
@ -72,26 +72,26 @@
|
|||
(expect 'require :to-have-been-called-with 'core-editor))))
|
||||
|
||||
(describe "doom-load-autoloads-file"
|
||||
:var (doom-autoload-file doom-alt-autoload-file result)
|
||||
:var (doom-autoloads-file doom-alt-autoload-file result)
|
||||
(before-each
|
||||
(setq doom-autoload-file (make-temp-file "doom-autoload" nil ".el"))
|
||||
(with-temp-file doom-autoload-file)
|
||||
(byte-compile-file doom-autoload-file))
|
||||
(setq doom-autoloads-file (make-temp-file "doom-autoload" nil ".el"))
|
||||
(with-temp-file doom-autoloads-file)
|
||||
(byte-compile-file doom-autoloads-file))
|
||||
(after-each
|
||||
(delete-file doom-autoload-file)
|
||||
(delete-file (byte-compile-dest-file doom-autoload-file)))
|
||||
(delete-file doom-autoloads-file)
|
||||
(delete-file (byte-compile-dest-file doom-autoloads-file)))
|
||||
|
||||
(it "loads the byte-compiled autoloads file if available"
|
||||
(doom-load-autoloads-file doom-autoload-file)
|
||||
(doom-load-autoloads-file doom-autoloads-file)
|
||||
(expect (caar load-history) :to-equal-file
|
||||
(byte-compile-dest-file doom-autoload-file))
|
||||
(byte-compile-dest-file doom-autoloads-file))
|
||||
|
||||
(delete-file (byte-compile-dest-file doom-autoload-file))
|
||||
(doom-load-autoloads-file doom-autoload-file)
|
||||
(expect (caar load-history) :to-equal-file doom-autoload-file))
|
||||
(delete-file (byte-compile-dest-file doom-autoloads-file))
|
||||
(doom-load-autoloads-file doom-autoloads-file)
|
||||
(expect (caar load-history) :to-equal-file doom-autoloads-file))
|
||||
|
||||
(it "returns non-nil if successful"
|
||||
(expect (doom-load-autoloads-file doom-autoload-file)))
|
||||
(expect (doom-load-autoloads-file doom-autoloads-file)))
|
||||
|
||||
(it "returns nil on failure or error, non-fatally"
|
||||
(expect (doom-load-autoloads-file "/does/not/exist") :to-be nil)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue