Skip to content

Commit

Permalink
Generating docs with ExDoc instead of EDoc (#308)
Browse files Browse the repository at this point in the history
* Remove code for OTP < 21

* Add format check to CI

* Generating docs with ExDoc instead of EDoc

Uses the rebar3 plugin `rebar3_ex_doc`.
Can be used by `rebar3 ex_doc`.
  • Loading branch information
cw789 authored Feb 14, 2022
1 parent 197e7ea commit c6f25a7
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{config,src}]
[*.{config, src}]
indent_style = space

[*.{md,markdown}]
[*.md]
indent_style = space
trim_trailing_whitespace = false

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
os: [ubuntu-latest]
otp: ["24", "23", "22"]
rebar3: ["3.17.0"]
rebar3: ["3.18.0"]
profile: [test, ranch_v2]
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -51,6 +51,9 @@ jobs:
- name: Xref
run: make xref

- name: Format
run: rebar3 fmt --check

- name: Test
run: make test REBAR_PROFILE=${{ matrix.profile }}

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Doc
name: Docs

on:
push:
Expand All @@ -11,14 +11,14 @@ on:
jobs:

docs:
name: Build EDoc on OTP ${{ matrix.otp }}
name: Generate docs on OTP ${{ matrix.otp }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
otp: ["24"]
rebar3: ["3.17.0"]
otp: ["24"] # https://www.erlang.org/downloads
rebar3: ["3.18.0"] # https://www.rebar3.org

steps:
- uses: actions/checkout@v2
Expand All @@ -35,5 +35,5 @@ jobs:
key: ${{ runner.os }}-hex-${{ hashFiles('**/rebar.lock') }}
restore-keys: ${{ runner.os }}-hex-

- name: Build EDoc
run: make docs
- name: Generate docs by ExDoc
run: rebar3 ex_doc
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ clean:
@rebar3 clean -a

test:
ERL_AFLAGS="-s ssl"
ERL_AFLAGS="-s ssl"
rebar3 as $(REBAR_PROFILE) eunit -c

proper:
Expand All @@ -23,7 +23,10 @@ dialyze:
xref:
rebar3 as test xref

format:
rebar3 fmt

docs:
rebar3 edoc
rebar3 ex_doc

.PHONY: compile clean test dialyze
4 changes: 2 additions & 2 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# gen_smtp

[![Hex pm](http://img.shields.io/hexpm/v/gen_smtp.svg?style=flat)](https://hex.pm/packages/gen_smtp)
[![CI](https://github.com/gen-smtp/gen_smtp/workflows/CI/badge.svg)](https://github.com/gen-smtp/gen_smtp/actions?query=workflow%3ACI)
[![Documentation](https://github.com/gen-smtp/gen_smtp/workflows/Documentation/badge.svg)](https://github.com/gen-smtp/gen_smtp/actions?query=workflow%3ADocumentation)
[![CI](https://github.com/gen-smtp/gen_smtp/actions/workflows/ci.yml/badge.svg)](https://github.com/gen-smtp/gen_smtp/actions/workflows/ci.yml)
[![Docs](https://github.com/gen-smtp/gen_smtp/actions/workflows/docs.yml/badge.svg)](https://github.com/gen-smtp/gen_smtp/actions/workflows/docs.yml)

The Erlang SMTP client and server library.

Expand Down
11 changes: 11 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

{project_plugins, [
erlfmt,
rebar3_ex_doc,
rebar3_proper
]}.

{erlfmt, [
write,
{print_width, 120},
Expand Down Expand Up @@ -71,3 +73,12 @@
]}
]}
]}.

{ex_doc, [
{source_url, <<"https://github.com/gen-smtp/gen_smtp">>},
{extras, [
{'README.md', [{title, <<"Overview">>}]},
{'LICENSE', [{title, <<"License">>}]}
]},
{main, <<"readme">>}
]}.
2 changes: 1 addition & 1 deletion src/gen_smtp.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, gen_smtp, [
{description, "The extensible Erlang SMTP client and server library."},
{vsn, "1.1.1"},
{vsn, "1.2.0-dev"},
{applications, [kernel, stdlib, crypto, asn1, public_key, ssl, ranch]},
{registered, []},
{licenses, ["BSD-2-Clause"]},
Expand Down
10 changes: 0 additions & 10 deletions src/gen_smtp_server_session.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,7 @@
options = [] :: [tuple()]
}).

%% OTP-19: ssl:ssl_option()
%% OTP-20: ssl:ssl_option()
%% OTP-21: ssl:tls_server_option()
%% OTP-22: ssl:tls_server_option()
%% OTP-23: ssl:tls_server_option()
-ifdef(OTP_RELEASE).
-type tls_opt() :: ssl:tls_server_option().
-else.
-type tls_opt() :: ssl:ssl_option().
-endif.

-type options() :: [
{callbackoptions, any()}
Expand Down Expand Up @@ -180,7 +171,6 @@
-optional_callbacks([handle_info/2, handle_AUTH/4, handle_error/3]).

%% @doc Start a SMTP session linked to the calling process.
%% @see start/3
-spec start_link(
Ref :: ranch:ref(),
Transport :: module(),
Expand Down

0 comments on commit c6f25a7

Please sign in to comment.