Erlang on rails

| | Comments ()

Last week I was playing with my own Erlang examples. As an Erlang's good newcomer I run my examples in console but now they're growing up quickly and I'm thinking about an automatic process to compile and deploy my new testbeds. Among my goals ...

  • Provide myself a runnable skeleton where I can feel comfortable in Erlang
  • Set up a new different application in seconds
  • Explore Edoc
  • Share EoR with Mario ;)

Reading the Erlang's design guide I discover that one single Erlang application has not many files so I decided look in Serval, an Internet software VLAN switch developed in Erlang, to implement a tailored compilation process fulfilling my goals.

In this first face off I tested a basic application. It was a single application containing a supervisor and a generic server. Next I added compilation support, autoconf (courtesy of Mario) + configure + make, and documentation support (Edoc module).

With the previous stuff running I implemented a dirty script patching filenames and contents. This script was inspired by Ruby on Rails (RoR), an open source web framework optimized for sustainable productivity. Idea is simple, you execute the script with a application name and it clones/patchs a new skeleton.

Generating a single skeleton follows ...

jmunhoz@devel:~$ tar zxf 20061018_eor.tgz
jmunhoz@devel:~$ ls
20061018_eor  20061018_eor.tgz
jmunhoz@devel:~$ cd 20061018_eor
jmunhoz@devel:~/20061018_eor$ ls
jmunhoz@devel:~/20061018_eor$ ./ myapp
jmunhoz@devel:~/20061018_eor$ cd myapp/
jmunhoz@devel:~/20061018_eor/myapp$ autoconf
jmunhoz@devel:~/20061018_eor/myapp$ ./configure
jmunhoz@devel:~/20061018_eor/myapp$ make
jmunhoz@devel:~/20061018_eor/myapp$ ./bin/
Erlang (BEAM) emulator version 5.5.1 [source] [async-threads:0] [hipe]

Eshell V5.5.1  (abort with ^G)



Makefiles are ripped from Serval and they handle subdirs so if you want to cascade several applications in subdirs you only have to add the application names in the proper Makefiles. Have a look in Serval!

As always, if you want to generate documentation "make doc" is your friend :)

EoR is just an ironic name of course. Nobody implement many rails on eighteen lines of code!

Enjoy it!


comments powered by Disqus

Recent Entries