summaryrefslogtreecommitdiff
path: root/README.md
blob: efcecfdcc6392cadeb95a2a89a975611acd80188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
rebar
=====

rebar [3.0](#30) is an Erlang build tool that makes it easy to compile and test Erlang
applications, port drivers and releases.

[![Build Status](https://travis-ci.org/rebar/rebar3.svg?branch=master)](https://travis-ci.org/rebar/rebar3) [![Windows build status](https://ci.appveyor.com/api/projects/status/yx4oitd9pvd2kab3?svg=true)](https://ci.appveyor.com/project/TristanSloughter/rebar3)

rebar is a self-contained Erlang script, so it's easy to distribute or even
embed directly in a project. Where possible, rebar uses standard Erlang/OTP
conventions for project structures, thus minimizing the amount of build
configuration work. rebar also provides dependency management, enabling
application writers to easily re-use common libraries from a variety of
locations (git, hg, etc).

3.0 Alpha-6
====

[DOCUMENTATION](http://www.rebar3.org/v3.0/docs)

This is a preliminary branch, considered to be alpha, and still
very unstable. Use at your own risk, but please do report bugs
and issues encountered and we'll try to resolve problems as
soon as possible.

Compatibility with rebar 2.0 has been broken, and features removed to
limit scope.

### Commands

| Command    | Description |
|----------- |------------ |
| as         | Higher-order provider to run multiple tasks in sequence as certain profiles |
| compile    | Build project |
| clean      | Remove project apps beam files |
| cover      | Generate coverage info from data compiled by `eunit --cover` or `ct --cover` |
| ct         | Run Common Test suites |
| do         | Higher-order provider to run multiple tasks in sequence |
| dialyzer   | Run the Dialyzer analyzer on the project |
| edoc       | Generate documentation using edoc |
| eunit      | Run eunit tests |
| escriptize | Generate escript of project |
| help       | Print help for rebar or task |
| new        | Create new rebar project from templates |
| pkgs       | List available packages |
| release    | Build release of project |
| report     | Report on environment and versions for bug reports |
| shell      | Run shell with project apps in path |
| tar        | Package release into tarball |
| update     | Update package index |
| upgrade    | Fetch latest version of dep |
| version    | Print current version of Erlang/OTP and rebar |
| xref       | Run cross reference analysis on the project |

### Changes

* Fetches and builds deps if missing when running any command that relies on them
* Automatically recognizes `apps` and `lib` directory structure
* Relx for releases

### Gone

* Reltool integeration

### Providers

Providers are the modules that do the work to fulfill a user's command.

Example:

```erlang
-module(rebar_prv_something).

-behaviour(rebar_provider).

-export([init/1,
         do/1,
         format_error/1]).

-define(PROVIDER, something).
-define(DEPS, []).

%% ===================================================================
%% Public API
%% ===================================================================

-spec init(rebar_state:state()) -> {ok, rebar_state:state()}.
init(State) ->
    State1 = rebar_state:add_provider(State, rebar_provider:create([{name, ?PROVIDER},
                                                                    {module, ?MODULE},
                                                                    {bare, false},
                                                                    {deps, ?DEPS},
                                                                    {example, "rebar dummy"},
                                                                    {short_desc, "dummy plugin."},
                                                                    {desc, ""},
                                                                    {opts, []}])),
    {ok, State1}.

-spec do(rebar_state:state()) -> {ok, rebar_state:state()}.
do(State) ->
    %% Do something
    {ok, State}.

-spec format_error(any()) -> iolist().
format_error(Reason) ->
    io_lib:format("~p", [Reason]).
```


Building
--------

Recommended installation of [Erlang/OTP](http://www.erlang.org) is source built using [erln8](http://metadave.github.io/erln8/) or [kerl](https://github.com/yrashk/kerl). For binary packages use those provided by [Erlang Solutions](https://www.erlang-solutions.com/downloads/download-erlang-otp), but be sure to choose the "Standard" download option or you'll have issues building projects.

### Dependencies

To build rebar you will need a working installation of Erlang R15 (or later).

Should you want to clone the rebar repository, you will also require git.

#### Downloading

You can download a pre-built binary version of rebar3 based on the last commit from:

https://s3.amazonaws.com/rebar3/rebar3

#### Bootstrapping rebar3

```sh
$ git clone https://github.com/rebar/rebar3
$ cd rebar3
$ ./bootstrap
```

### Developing on rebar3

When developing you can simply run `escriptize` to build your changes but the new escript is under `_build/default/bin/rebar3`

```sh
$ ./rebar3 escriptize
$ _build/default/bin/rebar3
```


Contributing to rebar
=====================

Please refer to [CONTRIBUTING](CONTRIBUTING.md).

Community and Resources
-----------------------

In case of problems that cannot be solved through documentation or examples, you
may want to try to contact members of the community for help. The community is
also where you want to go for questions about how to extend rebar, fill in bug
reports, and so on.

The main place to go for questions is the [rebar mailing
list](http://lists.basho.com/pipermail/rebar_lists.basho.com/). If you need
quick feedback, you can try the #rebar channel on
[irc.freenode.net](http://freenode.net). Be sure to check the
[wiki](https://github.com/rebar/rebar/wiki) first, just to be sure you're not
asking about things with well known answers.

For bug reports, roadmaps, and issues, visit the [github issues
page](https://github.com/rebar/rebar/issues).

General rebar community resources and links:

- [Rebar Mailing List](http://lists.basho.com/pipermail/rebar_lists.basho.com/)
- #rebar on [irc.freenode.net](http://freenode.net/)
- [wiki](https://github.com/rebar/rebar/wiki)
- [issues](https://github.com/rebar/rebar/issues)