Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs housekeeping #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2023, Benoit Chesneau <bchesneau@gmail.com>.
Copyright (c) 2015-2024, Benoit Chesneau <bchesneau@gmail.com>.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# [certifi](https://github.com/certifi/erlang-certifi)

[![Build Status](https://github.com/certifi/erlang-certifi/workflows/build/badge.svg)](https://github.com/certifi/erlang-certifi)
[![CI](https://github.com/certifi/erlang-certifi/actions/workflows/erlang.yml/badge.svg)](https://github.com/certifi/erlang-certifi/actions/workflows/erlang.yml)
[![Hex](https://img.shields.io/hexpm/v/certifi.svg)](https://hex.pm/packages/certifi)
[![HexDocs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/certifi)

This Erlang library contains a CA bundle that you can reference in your Erlang
application. This is useful for systems that do not have CA bundles that
Expand Down Expand Up @@ -29,22 +31,16 @@ You can also retrieve the path to the file and load it by yourself if needed:
Path = certifi:cacertfile().
```

## Build & test
## Development

Testing:

```shell
$ rebar3 eunit
rebar3 eunit
```

## Documentation generation

### Edoc

#### Generate public API
`rebar3 edoc`

#### Generate private API
`rebar3 as edoc_private edoc`
Documentation:

### ExDoc

`rebar3 ex_doc --output edoc`
```shell
rebar3 ex_doc
```
14 changes: 9 additions & 5 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{minimum_otp_vsn, "21.3"}.

{erl_first_files, ["src/certifi_pt.erl"]}.

{erl_opts, [deterministic %% Added since OTP 20
,{platform_define, "^2", 'OTP_20_AND_ABOVE'}
]}.
{profiles, [
%% Since OTP 20
{default, [{erl_opts, [deterministic, {platform_define, "^2", 'OTP_20_AND_ABOVE'}]}]},
{docs, [{erl_opts, []}]}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

]}.

{project_plugins, [rebar3_hex, rebar3_ex_doc]}.

Expand All @@ -12,8 +16,8 @@

{ex_doc, [
{extras, [
{"README.md", #{title => "Overview"}},
{"LICENSE", #{title => "License"}}
{"README.md", #{title => "Overview"}},
{"LICENSE", #{title => "License"}}
]},
{main, "README.md"},
{source_url, "https://github.com/certifi/erlang-certifi"},
Expand Down
17 changes: 10 additions & 7 deletions src/certifi.erl
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
-module(certifi).
%% Causes the parse transformation function Module:parse_transform/2
%% Causes the parse transformation function Module:parse_transform/2
%% to be applied to the parsed code before the code is checked for errors.
-compile({parse_transform, certifi_pt}).

-export([cacertfile/0,
cacerts/0]).

%% @doc CACertFile gives the path to the file with an X.509 certificate list
%% containing the Mozilla CA Certificate that can then be used via the
%% cacertfile setting in ssl options passed to the connect function.

%% containing the Mozilla CA Certificate.
%%
%% The file is used via the `cacertfile' setting in {@link //ssl/ssl} options,
%% passed to the `ssl:connect/2,3,4' function.
-spec cacertfile() -> Result when
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Result :: file:filename_all().
cacertfile() ->
Expand All @@ -25,8 +26,10 @@ cacertfile() ->
filename:join(PrivDir, "cacerts.pem").

%% @doc CACerts builds an X.509 certificate list containing the Mozilla CA
%% Certificate that can then be used via the cacerts setting in ssl options
%% passed to the connect function.
%% Certificate.
%%
%% The certificate list is used via the `cacerts' setting in {@link //ssl/ssl}
%% options, passed to the `connect/2,3,4' function.
-spec cacerts() -> [binary(),...].
cacerts() ->
ok.
ok.