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
Main author: Nicolas Charpentier <[email protected]>
The repository contains:
- all the rake scripts in the directory rakelib.
- a sample application in the directory sample.
Copy the content of the rakelib directory to your own library.
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 >>
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=""
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
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.
This task compiles all source code in the lib directory (modules, applications, release files).
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”
This task runs unittests for a given application
This task runs a unittest coverage analysis. Coverage results are stored in the “cover” directory of each application.
This task generates a tarball archive for each releases in the directory tree. Archives are generated in TOP/distrib.
Starts an erlang shell with a code path containing all beam under lib directory
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
Start the local release ‘version’