Skip to content

Commit 66f9526

Browse files
committed
Update configs
1 parent a397200 commit 66f9526

File tree

6 files changed

+142
-11
lines changed

6 files changed

+142
-11
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sudo: false
2+
language: erlang
3+
install: true
4+
before_script:
5+
- wget https://s3.amazonaws.com/rebar3/rebar3
6+
- chmod +x rebar3
7+
env: PATH=$PATH:.
8+
cache:
9+
directories:
10+
- $HOME/.cache/rebar3/
11+
otp_release:
12+
- 19.3
13+
- 19.0
14+
- 18.3
15+
- 18.0
16+
script:
17+
- rebar3 as test do xref, dialyzer, eunit
18+
- rebar3 as test coveralls send

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22

33
*A WebSocket handler for [Elli](https://github.com/elli-lib/elli)*
44

5+
[![Erlang][erlang badge]][erlang downloads]
6+
[![Travis CI][travis badge]][travis builds]
7+
[![Coverage Status][coveralls badge]][coveralls link]
8+
[![Apache License][license badge]](LICENSE)
9+
10+
[erlang badge]: https://img.shields.io/badge/erlang-%E2%89%A518.0-red.svg
11+
[erlang downloads]: http://www.erlang.org/downloads
12+
[travis builds]: https://travis-ci.org/elli-lib/elli_websocket
13+
[travis badge]: https://travis-ci.org/elli-lib/elli_websocket.svg
14+
[coveralls badge]: https://coveralls.io/repos/github/elli-lib/elli_websocket/badge.svg?branch=develop
15+
[coveralls link]: https://coveralls.io/github/elli-lib/elli_websocket?branch=develop
16+
[license badge]: https://img.shields.io/badge/license-Apache%202.0-blue.svg
17+
518

619
## Installation
720

8-
You can add `elli_websocket` to your application by adding it as a dependency to your elli
21+
You can add `elli_websocket` to your application by adding it as a dependency to your elli
922
application.
1023

1124
```erlang
@@ -65,13 +78,13 @@ init(Req, Args) ->
6578

6679
handle(Req, Args) ->
6780
Method = case elli_request:get_header(<<"Upgrade">>, Req) of
68-
<<"websocket">> ->
81+
<<"websocket">> ->
6982
websocket;
7083
_ ->
71-
elli_request:method(Req)
84+
elli_request:method(Req)
7285
end,
7386
handle(Method, elli_request:path(Req), Req, Args).
74-
87+
7588
handle_event(_Event, _Data, _Args) ->
7689
ok.
7790

@@ -85,9 +98,9 @@ init_ws(_, _, _) ->
8598
ignore.
8699

87100
handle('websocket', [<<"echo_websocket">>], Req, Args) ->
88-
%% Upgrade to a websocket connection.
101+
%% Upgrade to a websocket connection.
89102
elli_websocket:upgrade(Req, Args),
90-
103+
91104
%% websocket is closed.
92105
{close, <<>>};
93106

elvis.config

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
elvis,
4+
[
5+
{config,
6+
[#{dirs => [
7+
"src"
8+
%% TODO: "test"
9+
],
10+
filter => "*.erl",
11+
files => [
12+
#{path => "src/elli_bstr.erl"},
13+
#{path => "src/elli_example_websocket.erl"},
14+
#{path => "src/elli_proplists.erl"},
15+
#{path => "src/elli_websocket.erl"},
16+
#{path => "src/elli_websocket_handler.erl"},
17+
#{path => "src/elli_ws_http.erl"},
18+
%% #{path => "./src/elli_ws_protocol.erl"}
19+
#{path => "src/elli_ws_request_adapter.erl"}
20+
],
21+
rules => [
22+
{elvis_style, line_length,
23+
#{limit => 100}},
24+
{elvis_style, no_tabs},
25+
{elvis_style, no_trailing_whitespace},
26+
{elvis_style, no_if_expression},
27+
{elvis_style, no_nested_try_catch},
28+
{elvis_style, invalid_dynamic_call,
29+
#{ignore => [
30+
elli_ws_request_adapter
31+
]}},
32+
{elvis_style, used_ignored_variable},
33+
{elvis_style, no_behavior_info},
34+
{elvis_style, state_record_and_type},
35+
{elvis_style, no_spec_with_records},
36+
{elvis_style, dont_repeat_yourself,
37+
#{min_complexity => 14}},
38+
{elvis_style, no_debug_call}
39+
],
40+
ruleset => erl_files
41+
},
42+
#{dirs => ["."],
43+
filter => "Makefile",
44+
ruleset => makefiles
45+
},
46+
#{dirs => ["."],
47+
filter => "rebar.config",
48+
ruleset => rebar_config
49+
},
50+
#{dirs => ["."],
51+
filter => "elvis.config",
52+
ruleset => elvis_config
53+
}
54+
]
55+
}
56+
]
57+
}
58+
].

rebar.config

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,47 @@
11
{erl_opts, [debug_info]}.
2+
3+
{xref_checks, [undefined_function_calls,locals_not_used]}.
4+
5+
{dialyzer, [{base_plt_apps, [elli]}]}.
6+
7+
{profiles, [
8+
{test, [
9+
{erl_first_files, [
10+
"src/elli_websocket_handler"
11+
]},
12+
{deps, [{elli, "2.0.1"}]}
13+
]},
14+
{docs, [
15+
{deps, [
16+
{elli, "2.0.1"},
17+
{edown, "0.8.1"}
18+
]}
19+
]}
20+
]}.
21+
22+
{edoc_opts, [
23+
{application, elli_websocket},
24+
{subpackages, false},
25+
{doclet, edown_doclet},
26+
{todo, true},
27+
{doc_path, [
28+
"http://raw.github.com/elli-lib/elli/develop/doc"
29+
]},
30+
{source_path, [
31+
"src",
32+
"_build/test/lib/elli"
33+
]}
34+
]}.
35+
36+
{project_plugins, [
37+
{coveralls, "1.4.0"},
38+
{rebar3_lint, "0.1.9"}
39+
]}.
40+
41+
{provider_hooks, [{pre, [{eunit, lint}]}]}.
42+
43+
{cover_enabled, true}.
44+
{cover_export_enabled, true}.
45+
%% {cover_excl_mods, []}.
46+
{coveralls_coverdata, "_build/test/cover/eunit.coverdata"}.
47+
{coveralls_service_name, "travis-ci"}.

rebar.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[].

rebar.test.config

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)