Browse Source

Switch to rebar3.

Roberto Ostinelli 9 years ago
parent
commit
26d9321ec1
8 changed files with 30 additions and 20 deletions
  1. 1 3
      .gitignore
  2. 0 1
      .travis.yml
  3. 5 8
      Makefile
  4. 21 1
      README.md
  5. 0 0
      rabar3-LICENSE.txt
  6. BIN
      rebar
  7. BIN
      rebar3
  8. 3 7
      test/syn_test_suite_helper.erl

+ 1 - 3
.gitignore

@@ -23,10 +23,8 @@ Temporary Items
 .apdisk
 
 # project ignores
-deps
-ebin
+_build
 erl_crash.dump
 *.beam
-.rebar
 test/results/*
 !test/results/.keep

+ 0 - 1
.travis.yml

@@ -7,7 +7,6 @@ otp_release:
   - 17.5
   - 17.4
   - 17.3
-  - 17.1
   - 17.0
   - R16B03-1
   - R16B03

+ 5 - 8
Makefile

@@ -1,27 +1,24 @@
 PROJECT_DIR:=$(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
 
 all:
-	@./rebar compile
+	@$(PROJECT_DIR)/rebar3 compile
 
 clean:
-	@./rebar clean
+	@$(PROJECT_DIR)/rebar3 clean
 	@find $(PROJECT_DIR)/. -name "erl_crash\.dump" | xargs rm -f
-	@find $(PROJECT_DIR)/. -name "*.beam" | xargs rm -f
 
 dialyze:
-	@dialyzer -n -c $(PROJECT_DIR)/src/*.erl
+	@$(PROJECT_DIR)/rebar3 dialyzer
 
 run:
-	@erl -pa $(PROJECT_DIR)/ebin \
+	@erl -pa `$(PROJECT_DIR)/rebar3 path` \
 	-name syn@127.0.0.1 \
 	+K true \
-	+P 5000000 \
-	+Q 1000000 \
 	-mnesia schema_location ram \
 	-eval 'syn:start(),syn:init().'
 
 tests: all
 	ct_run -dir $(PROJECT_DIR)/test -logdir $(PROJECT_DIR)/test/results \
-	-pa $(PROJECT_DIR)/ebin
+	-pa `$(PROJECT_DIR)/rebar3 path`
 
 travis: all tests

+ 21 - 1
README.md

@@ -41,10 +41,30 @@ Therefore, Availability has been chosen over Consistency and Syn is [eventually
 
 ## Install
 
+### Rebar3
+If you're using [rebar3](https://github.com/erlang/rebar3), add `syn` as a dependency in your project's `rebar.config` file:
+
+```erlang
+{syn, {git, "git://github.com/ostinelli/syn.git", {tag, "1.2.1"}}}
+```
+
+Or, if you're using [Hex.pm](https://hex.pm/) as package manager (with the [rebar3_hex](https://github.com/hexpm/rebar3_hex) plugin):
+
+```erlang
+{syn, "1.2.1"}
+```
+
+Then, compile:
+
+```bash
+$ rebar3 compile
+```
+
+### Rebar2
 If you're using [rebar](https://github.com/rebar/rebar), add `syn` as a dependency in your project's `rebar.config` file:
 
 ```erlang
-{syn, ".*", {git, "git://github.com/ostinelli/syn.git", "master"}}
+{syn, ".*", {git, "git://github.com/ostinelli/syn.git", {tag, "1.2.1"}}}
 ```
 
 Then, get and compile your dependencies:

+ 0 - 0
rebar-LICENSE.txt → rabar3-LICENSE.txt


BIN
rebar


BIN
rebar3


+ 3 - 7
test/syn_test_suite_helper.erl

@@ -56,13 +56,9 @@ set_environment_variables(Node) ->
     lists:foreach(F, AppsConfig).
 
 start_slave(NodeShortName) ->
-    EbinFilePath = filename:join([filename:dirname(code:lib_dir(syn, ebin)), "ebin"]),
-    TestFilePath = filename:join([filename:dirname(code:lib_dir(syn, ebin)), "test"]),
-    %% start slave
-    {ok, Node} = ct_slave:start(NodeShortName, [
-        {boot_timeout, 10},
-        {erl_flags, lists:concat(["-pa ", EbinFilePath, " ", TestFilePath])}
-    ]),
+    CodePath = code:get_path(),
+    {ok, Node} = ct_slave:start(NodeShortName, [{boot_timeout, 10}]),
+    true = rpc:call(Node, code, set_path, [CodePath]),
     {ok, Node}.
 
 stop_slave(NodeShortName) ->