Skip to content

Commit

Permalink
Merge pull request #4 from lpgauth/rebar3
Browse files Browse the repository at this point in the history
Rebar3
  • Loading branch information
lpgauth committed Jul 20, 2015
2 parents 7454366 + bafb4df commit 042f918
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 33 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
*.beam
*.o
*.plt
.eunit
.rebar
deps/
doc/README.md
ebin/
erl_crash.dump
_build
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
cache:
directories:
- $HOME/.cache/rebar3
language: erlang
notifications:
email: false
otp_release:
- 18.0
- 17.5
- R16B03-1
script: "make build-plt dialyze eunit xref"
services:
- memcached
script: "make test"
sudo: false
38 changes: 16 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
PROJECT=anchor
REBAR=./rebar
REBAR=./rebar3

all: deps compile doc

build-plt: all
@dialyzer --build_plt --output_plt ~/.$(PROJECT).plt \
--apps erts kernel stdlib crypto public_key ssl
all: compile

clean:
@echo "Running rebar clean..."
@echo "Running rebar3 clean..."
@$(REBAR) clean
@rm -rf deps ebin

compile:
@echo "Running rebar compile..."
@echo "Running rebar3 compile..."
@$(REBAR) compile

deps:
@echo "Running rebar update-deps..."
@$(REBAR) update-deps

dialyze:
@dialyzer ebin/*.beam --plt ~/.$(PROJECT).plt -I include
dialyzer:
@echo "Running rebar3 dialyze..."
@$(REBAR) dialyzer

doc:
@echo "Running rebar doc..."
@$(REBAR) skip_deps=true doc
edoc:
@echo "Running rebar3 edoc..."
@$(REBAR) as doc edoc

eunit:
@echo "Running rebar eunit..."
@$(REBAR) skip_deps=true eunit
@echo "Running rebar3 eunit..."
@rm -rf _build/test/lib
@$(REBAR) do eunit, cover --verbose

test: all eunit
test: dialyzer eunit xref

xref:
@$(REBAR) skip_deps=true xref
@echo "Running rebar3 xref..."
@$(REBAR) xref

.PHONY: deps doc test xref
1 change: 1 addition & 0 deletions doc/edoc-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%% encoding: UTF-8
{application,anchor}.
{packages,[]}.
{modules,[anchor,anchor_app,anchor_backlog,anchor_protocol,anchor_queue,
anchor_server,anchor_sup,anchor_utils]}.
Binary file removed rebar
Binary file not shown.
13 changes: 8 additions & 5 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{cover_enabled, true}.
{cover_print_enabled, true}.

{deps, [
{edown, ".*", {git, "https://github.com/uwiger/edown.git", "HEAD"}}
]}.

{edoc_opts, [
{app_default, "http://www.erlang.org/doc/man"},
Expand All @@ -20,6 +15,14 @@
warnings_as_errors
]}.

{profiles, [
{doc, [
{deps, [
{edown, {git, "https://github.com/uwiger/edown.git", {tag, "0.7"}}}
]}
]}
]}.

{xref_checks, [
deprecated_functions,
deprecated_function_calls,
Expand Down
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[].
Binary file added rebar3
Binary file not shown.
10 changes: 8 additions & 2 deletions src/anchor_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
warning_msg/2
]).

-ifdef(TEST).
-define(IF_DEF_TEST, fun (_F) -> ok end).
-else.
-define(IF_DEF_TEST, fun (F) -> F() end).
-endif.

%% public
child_name(N) ->
list_to_atom(?SERVER_BASE_NAME ++ integer_to_list(N)).
Expand All @@ -17,7 +23,7 @@ child_specs() ->
[?CHILD(child_name(N), ?SERVER) || N <- lists:seq(1, PoolSize)].

error_msg(Format, Data) ->
error_logger:error_msg("[anchor] " ++ Format, Data).
?IF_DEF_TEST(fun () -> error_logger:error_msg("[anchor] " ++ Format, Data) end).

warning_msg(Format, Data) ->
error_logger:warning_msg("[anchor] " ++ Format, Data).
?IF_DEF_TEST(fun () -> error_logger:warning_msg("[anchor] " ++ Format, Data) end).

0 comments on commit 042f918

Please sign in to comment.