Created
September 12, 2020 00:04
-
-
Save vinikira/daa90358d29266517b894b9a7c2e6eac to your computer and use it in GitHub Desktop.
Adivice emacs exunit to use a custom mix command (e.g a docker container)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((elixir-mode . ((my/use-exunit-custom . t) | |
(my/exunit-custom-mix-cmd . "docker exec -it <container_id_or_name> mix")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; advice exunit execution to use Doca | |
(defvar my/use-exunit-custom nil) | |
(defvar my/exunit-custom-mix-cmd "docker exec -it <container_id_or_name> mix") | |
(defun my/exunit-compile (orig-fun &rest args) | |
(if my/use-exunit-custom | |
(let* ((directory (cadr args)) | |
(default-directory (or directory (exunit-project-root))) | |
(compilation-environment exunit-environment) | |
(args (car args))) | |
(exunit-do-compile | |
(s-join " " (append (list my/exunit-custom-mix-cmd "test") exunit-mix-test-default-options args)))) | |
(apply orig-fun args))) | |
(advice-add 'exunit-compile :around #'my/exunit-compile) | |
;; to remove | |
;; (advice-remove 'exunit-compile #'my/exunit-compile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Customize and move code from
.dir-locals.el
to root of your Elixir project.