Skip to content

Commit

Permalink
Merge pull request #31 from rustkas/hex_doc
Browse files Browse the repository at this point in the history
mix style documentation
  • Loading branch information
mworrell authored May 31, 2022
2 parents 826291e + 87ffff3 commit d98cce2
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ logs/*
rebar3
.rebar3
.rebar
doc
edoc
doc/*
!doc/overview.edoc

## libtool
.deps
Expand Down
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ test: $(REBAR)
dialyzer: $(REBAR)
$(REBAR) as test dialyzer

edoc:
mkdir -p doc && cp -fR doc_src/* doc
$(REBAR) edoc

edoc_private:
mkdir -p doc && cp -fR doc_src/* doc
$(REBAR) as edoc_private edoc

clean: $(REBAR)
$(REBAR) clean

Expand All @@ -34,3 +26,15 @@ clean: $(REBAR)
-eval '{ok, saved_to_file} = httpc:request(get, {"$(REBAR_URL)", []}, [], [{stream, "./rebar3"}])' \
-s inets stop -s init stop
chmod +x ./rebar3

##
## Doc targets
##
edoc: $(REBAR)
$(REBAR) edoc

edoc_private: $(REBAR)
$(REBAR) as edoc_private edoc

exdoc: $(REBAR)
$(REBAR) ex_doc --logo doc/img/logo.png --output edoc
36 changes: 28 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Verify the password:
true
4> {ok, Hash} =:= bcrypt:hashpw("bar", Hash).
false
````
```
Configuration
-------------
Expand All @@ -97,23 +97,22 @@ application's environment:

`default_log_rounds`
Sets the default number of rounds which define the complexity of the
hash function. Defaults to ``12``.
hash function. Defaults to `12`.

`mechanism`
Specifies whether to use the NIF implementation (`'nif'`) or a
pool of port programs (`'port'`). Defaults to `'nif'`.

`Note: the NIF implementation no longer blocks the Erlang VM
scheduler threads`
`Note: the NIF implementation no longer blocks the Erlang VM scheduler threads`

`pool_size`
Specifies the size of the port program pool. Defaults to ``4``.
Specifies the size of the port program pool. Defaults to `4`.

`nif_pool_size`
Specifies the size of the nif program pool. Defaults to ``4``.
Specifies the size of the nif program pool. Defaults to `4`.

`nif_pool_max_overflow`
Specifies the max workers to overflow of the nif program pool. Defaults to ``10``.
Specifies the max workers to overflow of the nif program pool. Defaults to `10`.

Run tests
---------
Expand All @@ -130,7 +129,7 @@ To test all exported function of a module use:
$ ./rebar3 as test shell
===> Verifying dependencies...
===> Compiling bcrypt
make: Nothing to be done for `all'.
make: Nothing to be done for all.
Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Eshell V11.0 (abort with ^G)
Expand All @@ -157,6 +156,27 @@ OK: Passed 100 test(s).
4>
```

## Documentation generation

### Edoc

#### Generate public API
```
rebar3 edoc
```

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

### ExDoc

```
rebar3 ex_doc --output edoc
```


Both the _port_ and the _NIF_ version of bcrypt are tested.
All tests should pass.

Expand Down
File renamed without changes.
21 changes: 19 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
no_return
]}
]},

{plugins, [
rebar3_proper
]},
{deps, [{proper,"1.4.0"}]}
]},
{edoc_private, [
Expand All @@ -42,4 +44,19 @@
]}
]}.

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

{hex, [
{doc, #{provider => ex_doc}}
]}.

{ex_doc, [
{extras, [
{"README.md", #{title => "Overview"}},
{"LICENSE", #{title => "License"}}
]},
{main, "README.md"},
{source_url, "https://github.com/erlangpack/bcrypt"},
{assets, "assets"},
{api_reference, true}
]}.

0 comments on commit d98cce2

Please sign in to comment.