天天看點

【轉載】stackoverflow 上關于 rebar 的讨論

your config file worked for me so i'd suggest doing the following: 

make sure you have git installed

put the most recent build of rebar in your project directory

use a makefile like the one i described here

delete your existing deps directory

run make

if you want to use rebar directly instead of using make you can do: 

<a href="http://my.oschina.net/moooofly/blog/277251#">?</a>

1

2

<code>$ .</code><code>/rebar</code> <code>get-deps</code>

<code>$ .</code><code>/rebar</code> <code>compile</code>

editor: you can use whatever you want. i used emacs for my first year of erlang, but i'm currently using gedit. 

version control: i like git. it seems that most of the erlang community agrees (most projects are hosted on github). 

workflow: i'd recommend getting familiar with rebar. 

here is an example of a rebar-flavored makefile: 

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

<code>rebar := .</code><code>/rebar</code>

<code>.phony: all deps doc</code><code>test</code> <code>clean release</code>

<code>all: deps</code>

<code>    </code><code>$(rebar) compile</code>

<code>deps:</code>

<code>    </code><code>$(rebar) get-deps</code>

<code>doc:</code>

<code>    </code><code>$(rebar) doc skip_deps=</code><code>true</code>

<code>test</code><code>:</code>

<code>    </code><code>$(rebar) eunit skip_deps=</code><code>true</code>

<code>clean:</code>

<code>    </code><code>$(rebar) clean</code>

<code>release: all</code><code>test</code>

<code>    </code><code>dialyzer --src src/*.erl deps/*</code><code>/src/</code><code>*.erl</code>

here are some basic pointers: 

put your unit tests in the same modules as the code they are testing. see the rebar wiki for details.

add {cover_enabled, true} to your rebar.config file. every time you run make test you get a coverage report in html!

add your project's dependencies to your rebar.config and you can fetch and build them when you run make deps.

make sure to comment your code with edoc. if you do, rebar can build all of your docs when your run make doc.