From 049f4636e0c0deef8a318320c47bc8c814a7430b Mon Sep 17 00:00:00 2001 From: Alexandre Costa Date: Wed, 12 Jun 2024 14:38:10 -0700 Subject: [PATCH] Setup ex_doc in mix.exs --- README.md | 34 ++++++++++++++++++---------------- mix.exs | 25 ++++++++++++++++++++++--- mix.lock | 6 ++++++ 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 17254d1..9267b83 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/mix.exs b/mix.exs index cc38b5e..569e410 100644 --- a/mix.exs +++ b/mix.exs @@ -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 @@ -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 diff --git a/mix.lock b/mix.lock index 6f00cfe..57807da 100644 --- a/mix.lock +++ b/mix.lock @@ -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"}, }