What is the fastest way to edit an Erlang application, compile the code and see the running result? Preferably jumping in the Erlang shell on the last step.
My current newbie setup:
Is there a faster way? BTW. my editor of choice is Emacs.
what you can also try is erlbuild. Erlbuild is an simple application which looks in src directory for changed source files and if it finds some files, than it compiles and load the modules again. After loading the modules, erlbuild runs the the tests of the modules.
You can find the project under : https://github.com/ulfa/erlbuild
~Ulf
Here's my setup:
make
in the source directory.l()
in Erlang shell. You can find this and some other useful macros here: http://www.snookles.com/erlang/user_default.erl
There's rarely a need to restart the whole Erlang application. Reloading changed modules is a more common use-case and it is usually enough to apply your changes.
Regarding application start: if your application depends on other applications, application:start() will fail, until you start all the dependencies. Because of that, it is common to write a helper function <your-app-name>:start()
. Here's an example. Another useful function is <your-app-name>:stop()
.
With all these techniques applied, a workflow would look like this:
<your-app-name>:start().
l()
in your Erlang shell.<your-app-name>:stop(), <your-app-name>:start().
You might look at rebar as a building tool. make:all/0
and the whole make module could help as well. To explicitly reload a module from the shell you can use l(Module)
. Finally, you might also be interested in creating an Erlang release to "wrap" all your Erlang applications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With