Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang workflow

How do you organize your erlang workflow? I'm learning some Erlang now and I'm using Rebar, recompiling, rebuilding and restarting an entire release (I'm trying to keep things OTP'ish) after each edit. I'm pretty sure that there is a smarter way to do this.

like image 771
lambdadmitry Avatar asked Feb 15 '11 16:02

lambdadmitry


2 Answers

In Etorrent, I am using a little trick you may like:

When you have built a development release, you can execute the command make console which has the following definition:

console:
    dev/etorrent-dev/bin/etorrent console \
            -pa ../../apps/etorrent/ebin

basically, it uses the release ebins for most stuff, but overrides the application ebin to be outside at the point where you normally build the software. Now, running a console, you can edit your code, run make (I hit a key combination in Emacs), fix errors, run make again and so on. When you are satisfied with your change, you go into the console (erlang shell) and execute l(ModuleToLoad) at which point the running system gets the new code injected. OTP will automatically pick up the hot-deployed code change and alter the processes. Essentially you only have to restart fairly rarely when working on the code.

Nowadays, we also have tests, so you can execute make test in etorrent to have the test framework run on your newly formed code before injection if you want a bit more guarantee that the new code works.

like image 64
I GIVE CRAP ANSWERS Avatar answered Oct 26 '22 02:10

I GIVE CRAP ANSWERS


With Chicago Boss you just hit "Refresh" in your web browser:

http://www.chicagoboss.org/

Even if your goal isn't web development, it might be a way to learn Erlang that is more fun than your current workflow. CB pretty-prints compilation and run-time errors right in the browser.

like image 30
Emiller Avatar answered Oct 26 '22 03:10

Emiller