An OTP application to auto compile changed files into an erlang node.
edt
uses fs to be notified on files
changes and requires a platform specific fs
backend to be installed
which can be installed like
brew install fswatch
<install> inotify-tools
Add the following line to the rebar3
profile of your choice
{edt, "", {git, "https://github.com/raghavkarol/edt.git", {branch, "master"}}}
Then start and erlang node like
(REBAR3_PROFILE=<profile> ; rebar3 as <profile> shell --apps edt)
Now editing and changing a file will automatically reload
Post actions are executed on successful compile and reload of a module. For example to run tests eunit tests in a module do:
1> edt_post_action:add(
_Name = test_1, _
Action = fun() ->
edt_api:test(module_with_eunit_tests)
end).
2> edt_post_action:add(
_Name = test_2,
_Action = fun() ->
edt_api:test(ct_SUITE)
end).
There can be multiple post actions are are executed in the Name
order.
To use as a flymake backend we can extend flycheck-rebar3 available on ELPA with the following configuration.
(flycheck-define-checker erlang-edt-flycheck
"An Erlang syntax checker using the edt server."
:command ("~/bin/flycheck_edt" (eval (buffer-file-name)))
:error-parser flycheck-parse-with-patterns-without-color
:error-patterns
((warning line-start
(file-name) ":" line ": Warning:" (message) line-end)
(error line-start
(file-name) ":" line ": " (message) line-end))
:modes erlang-mode
:enabled flycheck-rebar3-project-root
:predicate flycheck-buffer-saved-p
:working-directory flycheck-rebar3-project-root)
(add-to-list 'flycheck-checkers 'erlang-edt-flycheck)
See flycheck_edt
What is edt_profile, examples of how to use it.
EDT_PROFILE_TRACK_CALLS=true
EDT_PROFILE_MAX_CALLS=1000
EDT_PROFILE_CAPTURE=true