Skip to content

Configuring Assemblies

hyperthunk edited this page Apr 30, 2011 · 14 revisions

An "assembly" is a group of files and/or directories assembled into an archive and distributed. File system entries are included (or excluded) by setting up the appropriate entries in your configuration. For example, consider the following additions to a standard, top level rebar.config, which will put the entire [rebar generated release](https://github.com/basho/rebar/wiki/Release-handling) into an archive, but exclude the erts subdirectories.

{sub_dirs, ["rel"]}.
{dist, [
    {incl_dirs, ["rel/*"]},
    {excl_dirs, ["**/erts-*"]}
]}.

The plugin will work out the difference between overlapping includes and excludes so as to remove the directory matching the +erts-* + glob pattern from the output prior to archiving.

Assembly Configuration Parameters

These parameters can be given to any assembly tuple, wherever it is sourced from.

Option Description Default

format

The output format, one of zip,tar,targz.

targz

outdir

The output directory into which all assemblies should be placed.

./dist

workdir

The directory in which all temporary file system entries should be dealt with.

./dist/.work

incl_dirs

List of glob patterns, literal folder names or folder specs to include.

No Default

excl_dirs

List of glob patterns, literal folder names or folder specs to exclude.

No Default

incl_files

List of glob patterns, literal file names or file specs to include.

No Default

excl_files

List of glob patterns, literal file names or file specs to exclude.

No Default

vars_file

The (absolute or relative) path to a file containing variables for substitution.

No Default.

Notes

The incl and excl options for both files and folders take lists, containing one of three kinds of configuration entry. The first is a simple path, which can be relative or absolute and is represented as a string. The second, a glob expression passed to filelib:fold_files/5 in order to collect files (or directories), also represented as a string. When passed one of Path or Glob, an instance of the third configuration element is created. This spec tuple is defined as {spec, Path, Glob, Target, Mode, Template}. The Elements have the following semantics:

Element Description Default

Path

The (absolute or relative) path to the file or directory. Ignored if Glob is present.

undefined

Glob

A glob expression for the dile or directory.

undefined

Target

The target output directory (for files) or path (for directories).

See Further Notes below.

Mode

The file or directory permissions (set with file:change_mode/2).

See Further Notes below.

Template

If true, any matching file(s) are rendered by rebar_templater. Ignored for directories

false.

Further Notes

If the Target field is given, it is handled in the following manner prior to archiving:

  • For files, the full directory Target is created (if necessary) and the file(s) copied into it

  • For directories, the directory is copied (recursively) into the Target location

The default Target for files is a copy of the full (absolute or relative) directory path of the file. For directories, the default value is the base name of the directory. For example, a relative file path "x/y/z.erl" (taken from /home/me/code/myproject) will end up in home/me/code/myproject/x/y/z.erl, whereas an absolute path "/var/log/foobar.log" will end up in var/log/foobar.log. For a directory stated "release/myproject", the default output path (in the archive) will be myproject.

If the Template field is set to true for a file, the contents of the assembly’s vars_file are loaded and passed to rebar_templater:render/2 along with the binary contents of the file. This field is ignored when processing directories.

Clone this wiki locally