Skip to content

Commit 51f03c8

Browse files
committed
Misc doc changes
Besides other documentation changes, this commit ensures the generated HTML doc for HexDocs.pm will become the source of truth for this Elixir library and leverage on latest features of ExDoc.
1 parent cb569b4 commit 51f03c8

File tree

6 files changed

+83
-47
lines changed

6 files changed

+83
-47
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# The directory Mix downloads your dependencies sources to.
88
/deps/
99

10-
# Where 3rd-party dependencies like ExDoc output generated docs.
10+
# Where third-party dependencies like ExDoc output generated docs.
1111
/doc/
1212

1313
# Ignore .fetch files in case you like to edit your project deps locally.
@@ -22,6 +22,10 @@ erl_crash.dump
2222
# Ignore package tarball (built via "mix hex.build").
2323
extrace-*.tar
2424

25+
# Temporary files, for example, from tests.
26+
/tmp/
27+
28+
# Misc.
2529
.elixir_ls
2630
.idea
2731
*.iml

LICENSE

-25
Original file line numberDiff line numberDiff line change
@@ -174,28 +174,3 @@ incurred by, or claims asserted against, such Contributor by reason
174174
of your accepting any such warranty or additional liability.
175175

176176
END OF TERMS AND CONDITIONS
177-
178-
APPENDIX: How to apply the Apache License to your work.
179-
180-
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "{}"
182-
replaced with your own identifying information. (Don't include
183-
the brackets!) The text should be enclosed in the appropriate
184-
comment syntax for the file format. We also recommend that a
185-
file or class name and description of purpose be included on the
186-
same "printed page" as the copyright notice for easier
187-
identification within third-party archives.
188-
189-
Copyright 2016 Bing Han
190-
191-
Licensed under the Apache License, Version 2.0 (the "License");
192-
you may not use this file except in compliance with the License.
193-
You may obtain a copy of the License at
194-
195-
http://www.apache.org/licenses/LICENSE-2.0
196-
197-
Unless required by applicable law or agreed to in writing, software
198-
distributed under the License is distributed on an "AS IS" BASIS,
199-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200-
See the License for the specific language governing permissions and
201-
limitations under the License.
File renamed without changes.

README.md

+39-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
# Extrace
22

33
[![Hex.pm Version](https://img.shields.io/hexpm/v/extrace.svg?style=flat-square)](https://hex.pm/packages/extrace)
4+
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg?style=flat-square)](https://hexdocs.pm/extrace/)
5+
[![Total Download](https://img.shields.io/hexpm/dt/extrace.svg?style=flat-square)](https://hex.pm/packages/extrace)
6+
[![License](https://img.shields.io/hexpm/l/extrace.svg?style=flat-square)](https://github.com/redink/extrace/blob/master/LICENSE.md)
7+
[![Last Updated](https://img.shields.io/github/last-commit/redink/extrace.svg?style=flat-square)](https://github.com/redink/extrace/commits/master)
48

59
Extrace is an Elixir wrapper for [Recon Trace](https://ferd.github.io/recon/recon_trace.html).
610

7-
## Example
11+
## Installation
812

9-
1, set point
13+
The package can be installed by adding `:extrace` to your list of dependencies
14+
in `mix.exs`:
1015

1116
```elixir
12-
iex(1)> Extrace.calls([{Enum, :take_random, fn _ -> :return end}, {Enum, :count, fn _ -> :return end}], 100, [scope: :local])
17+
def deps do
18+
[
19+
{:extrace, "~> 0.3.0"}
20+
]
21+
end
22+
```
23+
24+
## Examples
25+
26+
Set point:
27+
28+
```elixir
29+
iex> Extrace.calls([{Enum, :take_random, fn _ -> :return end}, {Enum, :count, fn _ -> :return end}], 100, [scope: :local])
1330
4
1431
```
1532

1633
Note that the functions to be traced (`:take_random` and `:count` in the example above) can only be private if `scope: :local` is set.
1734

18-
2, one function executed
35+
One function executed:
1936

2037
```elixir
2138
iex(2)> Enum.take_random([1,2,3,4], 200)
@@ -46,7 +63,7 @@ iex(2)> Enum.take_random([1,2,3,4], 200)
4663
18:42:10.842046 <0.183.0> Enum.take_random/2 --> [2, 4, 3, 1]
4764
```
4865

49-
3, another function executed
66+
Another function executed:
5067

5168
```elixir
5269
iex(4)> Enum.count([1,2,3,4])
@@ -57,5 +74,20 @@ iex(4)> Enum.count([1,2,3,4])
5774
18:42:27.383795 <0.183.0> Enum.count/1 --> 4
5875
```
5976

60-
## Other
61-
Original library [repository](https://github.com/tatsuya6502/recon_ex)
77+
## Copyright and License
78+
79+
Copyright (c) 2015, 2016 Tatsuya Kawano under [MIT License](./ORIGINAL-LICENSE.md). Fork from [https://github.com/tatsuya6502/recon_ex](https://github.com/tatsuya6502/recon_ex)
80+
81+
Copyright (c) 2019 redink
82+
83+
Licensed under the Apache License, Version 2.0 (the "License");
84+
you may not use this file except in compliance with the License.
85+
You may obtain a copy of the License at
86+
87+
http://www.apache.org/licenses/LICENSE-2.0
88+
89+
Unless required by applicable law or agreed to in writing, software
90+
distributed under the License is distributed on an "AS IS" BASIS,
91+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92+
See the License for the specific language governing permissions and
93+
limitations under the License.

lib/extrace.ex

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ defmodule Extrace do
55
@moduledoc """
66
`Extrace` provides functions for tracing events in a safe
77
manner for single Erlang virtual machine, currently for function
8-
calls only. Functionality includes:
8+
calls only.
9+
10+
Functionality includes:
911
1012
- Nicer to use interface (arguably) than `:dbg` or trace BIFs.
1113
- Protection against dumb decisions (matching all calls on a node
1214
being traced, for example)
1315
- Adding safe guards in terms of absolute trace count or
14-
rate-limitting
16+
rate-limiting
1517
- Nicer formatting than default traces
1618
1719
## Tracing Elixir and Erlang Code
@@ -106,13 +108,13 @@ defmodule Extrace do
106108
an integer greater than `1`.
107109
108110
The limit was also set using `{10, 100}` instead of an integer,
109-
making the rate-limitting at 10 messages per 100 milliseconds,
111+
making the rate-limiting at 10 messages per 100 milliseconds,
110112
instead of an absolute value.
111113
112114
Any tracing can be manually interrupted by calling
113115
`Extrace.clear/0`, or killing the shell process.
114116
115-
Be aware that extremely broad patterns with lax rate-limitting (or
117+
Be aware that extremely broad patterns with lax rate-limiting (or
116118
very high absolute limits) may impact your node's stability in ways
117119
`Extrace` cannot easily help you with.
118120
@@ -328,7 +330,7 @@ defmodule Extrace do
328330

329331
@doc """
330332
Returns tspec with its `shellfun` replaced with `matchspec`.
331-
This futction is used by `calls/2` and `calls/3`.
333+
This function is used by `calls/2` and `calls/3`.
332334
"""
333335
@spec to_erl_tspec(tspec) :: tspec
334336
def to_erl_tspec({mod, fun, shellfun}) when is_function(shellfun) do

mix.exs

+32-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
defmodule Extrace.MixProject do
22
use Mix.Project
33

4+
@source_url "https://github.com/redink/extrace"
5+
@version "0.3.0"
6+
47
def project do
58
[
69
app: :extrace,
7-
version: "0.3.0",
10+
version: @version,
811
elixir: "~> 1.7",
912
start_permanent: Mix.env() == :prod,
13+
package: package(),
1014
deps: deps(),
11-
description: "Elixir wrapper for Recon Trace.",
12-
package: [
13-
name: "extrace",
14-
maintainers: ["redink"],
15-
licenses: ["Apache 2.0"],
16-
links: %{"GitHub" => "https://github.com/redink/extrace"}
17-
]
15+
docs: docs()
1816
]
1917
end
2018

@@ -27,7 +25,32 @@ defmodule Extrace.MixProject do
2725
defp deps do
2826
[
2927
{:recon, "~> 2.5"},
30-
{:ex_doc, "~> 0.19", only: [:dev, :test]}
28+
{:ex_doc, ">= 0.0.0", only: [:dev, :test], runtime: false}
29+
]
30+
end
31+
32+
defp package do
33+
[
34+
name: "extrace",
35+
description: "Elixir wrapper for Recon Trace.",
36+
maintainers: ["redink"],
37+
licenses: ["Apache-2.0"],
38+
links: %{
39+
"GitHub" => @source_url
40+
}
41+
]
42+
end
43+
44+
defp docs do
45+
[
46+
extras: [
47+
"ORIGINAL-LICENSE.md": [title: "Original License"],
48+
LICENSE: [title: "License"],
49+
"README.md": [title: "Overview"]
50+
],
51+
main: "readme",
52+
source_url: @source_url,
53+
formatters: ["html"]
3154
]
3255
end
3356
end

0 commit comments

Comments
 (0)