Skip to content

Commit

Permalink
Setup ex_doc in mix.exs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandremcosta committed Jun 12, 2024
1 parent 51349ce commit 049f463
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@ Wraps `eredis` and `eredis_sub` functionallity for Elixir usage.
- Publishes binary messages to Redis Pub/Sub channels.
- Subscribes to channels and calls a handler function when a message is received.

## Why not use `Phoenix.PubSub`?

Because multiple applications in many programming languages can use Redis Pub/Sub,
but they don't serialize their binary messages according to `Phoenix` schema.

## Why not use `eredis` directly?

That's also a great option. With `EredisSub` Elixir abstraction we intend to hide
Erlang specific knowledge, for example Erlang strings and OTP processes. We changed
the API to let clients subscribe a handler function to a Pub/Sub channel, similar
to how [`:telemetry`](https://hexdocs.pm/telemetry/readme.html) attaches handlers.

We sacrificed flexibility on client process architecture, for a simpler mental model.
If you need to handle message passing or a pool of processes, for example to handle
heavier loads, use `:eredis` directly.

## Usage

### Publish
Expand Down Expand Up @@ -78,3 +62,21 @@ children = [
{EredisSub, [database: 2, username: "foo", password: "bar"]}
]
```

## Motivations

### Why not use `Phoenix.PubSub`?

Because multiple applications in many programming languages can use Redis Pub/Sub,
but they don't serialize their binary messages according to `Phoenix` schema.

### Why not use `eredis` directly?

That's also a great option. With `EredisSub` Elixir abstraction we intend to hide
Erlang specific knowledge, for example Erlang strings and OTP processes. We changed
the API to let clients subscribe a handler function to a Pub/Sub channel, similar
to how [`:telemetry`](https://hexdocs.pm/telemetry/readme.html) attaches handlers.

We sacrificed flexibility on client process architecture, for a simpler mental model.
If you need to handle message passing or a pool of processes, for example to handle
heavier loads, use `:eredis` directly.
25 changes: 22 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
defmodule EredisSub.MixProject do
use Mix.Project

@source_url "https://github.com/loopsocial/eredis_sub/"
@version "0.1.0"

def project do
[
app: :eredis_sub,
version: "0.1.0",
description: "Elixir wrapper for Eredis pub/sub functionality ",
version: @version,
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
deps: deps()
deps: deps(),
package: package(),
docs: [
main: "readme",
extras: ["README.md"]
]
]
end

Expand All @@ -21,7 +30,17 @@ defmodule EredisSub.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:eredis, "~> 1.7"}
{:eredis, "~> 1.7"},
{:ex_doc, "~> 0.34.0", only: :dev, runtime: false}
]
end

defp package() do
[
licenses: ["Apache-2.0"],
organization: "loopsocial",
maintainers: ["Alexandre Costa"],
links: %{"GitHub" => @source_url}
]
end
end
6 changes: 6 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
%{
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
"eredis": {:hex, :eredis, "1.7.1", "39e31aa02adcd651c657f39aafd4d31a9b2f63c6c700dc9cece98d4bc3c897ab", [:mix, :rebar3], [], "hexpm", "7c2b54c566fed55feef3341ca79b0100a6348fd3f162184b7ed5118d258c3cc1"},
"ex_doc": {:hex, :ex_doc, "0.34.0", "ab95e0775db3df71d30cf8d78728dd9261c355c81382bcd4cefdc74610bef13e", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "60734fb4c1353f270c3286df4a0d51e65a2c1d9fba66af3940847cc65a8066d7"},
"makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
}

0 comments on commit 049f463

Please sign in to comment.