static-sites/bases/do-blog/resources/documents/lisp/run-drone-test-suite-from-e...

1.3 KiB
Executable File

Run drone test suite from emacs

.. title: Run drone test suite from emacs .. slug: run-drone-test-suite-from-emacs .. date: 2016-11-15 12:00:00 UTC .. tags: lisp, emacs .. category: lisp .. link: .. description: Example lisp code that run drone in a shell and outputs into a buffer the results. .. type: text

The first function drone-root simply searches for .drone.yml by searching up the file system tree from the current files path.

The second function drone-exec runs drone exec and output the results to a new buffer called *drone:.

(defun drone-root ()
  (or (locate-dominating-file default-directory ".drone.yml")
      (error "Missing .drone.yml not found in directory tree")))

;;;###autoload
(defun drone-exec ()
  "Run \"drone exec\" where .drone.yml is found."
  (interactive)
  (let ((default-directory (drone-root)))
    (with-current-buffer (get-buffer-create (concat "*drone: " default-directory "*"))
      (compilation-start (format "drone exec")
        nil
        (lambda (_) (buffer-name))))))