Oct 212008
i have started off a new project, mostly based on erlang, and i have decided to post few of my observations and experiences which i pick along the way. i will start with edoc and eunit, both i have added to my project with zero effort, and got remarkable results.
edoc produces automatic documentation for the project. i have just added the right code to my project makefile, and voula – instance documentation for my functions api. the code itself is:
docs: erl -noshell -eval "edoc:application($(APPNAME), \".\", [$(DOC_OPTS)])" -s init stop
where:
APPNAME = myappVSN = 0.1 DOC_OPTS = {def, {version, \"$(VSN)\"}}, no_packages
eunit gives an easy way to add unit testing to the project, again, i have added few lines to my makefile:
MODULES = $(patsubst %.erl,%,$(wildcard *.erl)) check: @for f in $(MODULES); do \ echo $$f; \ erl $(ERL_LIB_FLAGS) -noshell -s $$f test -s init stop; \ done
those few lines takes all the erl files on the current directory and run the test function for each module.
that’s it for the first time.