Skip to content
charpi edited this page Sep 13, 2010 · 14 revisions

Description

The ruby build tool rake can be extended by the addition of new libraries.
erl_rake is a set of rake libraries and scripts to add an erlang support to rake

Authors

Main author: Nicolas Charpentier <open_source@charpi.net>

Git repository

The repository contains:

  • all the rake scripts in the directory rakelib.
  • a sample application in the directory sample.

Installation

erl_rake libraries installation

You already use some extensions

Copy the content of the rakelib directory to your own library.

You don’t have any extensions

Two possibilities:

  • Copy the rakelib directory under the top directory of your project. You will be able to use rake without any options
  • or copy the rakelib anywhere. You will have to run rake with the option -rakelib << directory >>

Usage

erl_rake is designed to be used on projects using standard OTP directory layout.
Your project must contain a lib directory in which your OTP application code will be created.
To build your project with rake, you have to create a Rakefile at the top level.
The minimal content of it is


#-ruby-
require ‘rake’
task :default => [“erlang:compile”, “erlang:test”]

At this step in your top directory you can try to execute rake
At the first execution a configuration file erl_config.rb is created.


#ERL_TOP is the location of the erlang installation.
ERL_TOP=“/usr/local/lib/erlang-R13B-3”
#USE_EMAKE tells erl_rake how to compile erlang sources.
#Valid values are true and false.
USE_EMAKE=true
#ERLC_FLAGS are the flags to be passed to the compiler ERLC.
ERLC_FLAGS=""
#EMAKE_COMPILE_OPTIONS are the flags to be passed to the EMAKE.
EMAKE_COMPILE_OPTIONS = []
#ERL_FLAGS are the flags to be passed to ERL when erl_rake
#start a node.
ERL_FLAGS=""

Tasks descriptions

otp:new_application[name]

This task creates a new application skeleton. After executing rake otp:new_application[name], the application directory is created in the lib directory.

The skeleton includes 2 specific files:

  • lib/name/vsn.config: Contains the version number
  • lib/name/src/name.app.src: Contains a template for the app file. The real application file is generated by compilation tasks

otp:new_release[name]

This task creates a new release skeleton. After executing rake otp:new_release[name], the application directory is created in the lib directory.

The skeleton includes 2 specific files:

  • lib/name/src/name.rel.src: Contains a template for the rel file. The real rel file is generated by compilation tasks
  • lib/name/vsn.config: Contains the release name

The skeleton also creates a configuration directory called ‘release_config’. This directory contains 2 files:

  • sys.config: The main configuration file
  • startup.conf: script file sourced by release startup scripts
    Those two files will be used during release packaging.

erlang:compile

This task compiles all source code in the lib directory (modules, applications, release files).

erlang:tests

This tasks runs unittests for each application under lib directory.
Tests (located in the test directory) can be either:

  • plain eunit modules
  • a file containing eunit test description. The file must be named “test.desc”

erlang:tests[name]

This task runs unittests for a given application

erlang:cover and erlang:cover[name]

This task runs a unittest coverage analysis. Coverage results are stored in the “cover” directory of each application.

erlang:releases

This task generates a tarball archive for each releases in the directory tree. Archives are generated in TOP/distrib.

otp:shell

Starts an erlang shell with a code path containing all beam under lib directory

otp:deploy

Deploy a release locally. All start-up files are generated in order to use beam files located under TOP/lib.
The configuration file used is a copy of TOP/AppX/release_config/sys.config

otp:start_release[version]

Start the local release version