Skip to content

Commit

Permalink
Merge pull request #86 from kianmeng/misc-doc-changes
Browse files Browse the repository at this point in the history
Misc doc changes
  • Loading branch information
benwilson512 authored Apr 3, 2021
2 parents 07334a0 + d688d7c commit 3488b43
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 51 deletions.
1 change: 1 addition & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Used by "mix format"
[
inputs: [
"{config,lib,priv,test}/**/*.{ex,exs}",
Expand Down
22 changes: 15 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
# The directory Mix will write compiled artifacts to.
.elixir_ls

/_build
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover
/cover/

# The directory Mix downloads your dependencies sources to.
/deps
/deps/

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

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
absinthe_phoenix-*.tar

# The directory Mix will write compiled artifacts to.
.elixir_ls

# Misc.
.DS_Store
14 changes: 8 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# v2.0.0
# Changelog

## v2.0.0 - 2020-05-14

- Phoenix.PubSub 2.0 support

# v1.5.0
## v1.5.0 - 2020-05-14

- Absinthe 1.5 support

# v1.4.4
## v1.4.4 - 2019-05-04

- Remove unintentional poison dependency

# v1.4.2
## v1.4.2 - 2018-01-22

- Add `variables/1` function to make it easy to get the original parameters

# v1.4.1
## v1.4.1 - 2018-01-21

- Deprecate `Absinthe.Phoenix.Socket.put_opts/2` in favor of `Absinthe.Phoenix.Socket.put_options/2` for consistency with Absinthe.Plug

# v1.4.0
## v1.4.0 - 2017-11-13

- First real release.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Bruce Williams, Ben Wilson
Copyright (c) 2016 Bruce Williams, Ben Wilson

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ For Phoenix 1.4, see the v1.5 branch: https://github.com/absinthe-graphql/absint

```elixir
def deps do
[{:absinthe_phoenix, "~> 2.0.0"}]
[
{:absinthe_phoenix, "~> 2.0.0"}
]
end
```

Expand All @@ -49,7 +51,7 @@ See the [GitHub organization](https://github.com/absinthe-graphql).

## Usage

You need to have a working phoenix pubsub configured. Here is what the default looks like if you create a new phoenix project:
You need to have a working Phoenix PubSub configured. Here is what the default looks like if you create a new Phoenix project:

```elixir
config :my_app, MyAppWeb.Endpoint,
Expand Down Expand Up @@ -115,6 +117,8 @@ our [Code of Conduct](./CODE_OF_CONDUCT.md).

Please follow [contribution guide](./CONTRIBUTING.md).

## License
## Copyright and License

See [LICENSE.md](./LICENSE.md).
Copyright (c) 2016 Bruce Williams, Ben Wilson

Released under the MIT License, which can be found in [LICENSE.md](./LICENSE.md).
36 changes: 17 additions & 19 deletions lib/absinthe/phoenix/socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Absinthe.Phoenix.Socket do
`Absinthe.Phoenix.Socket` is used as a module for setting up a control
channel for handling GraphQL subscriptions.
## Example
## Examples
defmodule MyApp.Web.UserSocket do
use Phoenix.Socket
Expand All @@ -24,7 +24,7 @@ defmodule Absinthe.Phoenix.Socket do
## Phoenix 1.2
If you're on Phoenix 1.2 see `put_schema/2`
If you're on Phoenix 1.2 see `put_schema/2`.
"""

defmacro __using__(opts) do
Expand All @@ -44,23 +44,22 @@ defmodule Absinthe.Phoenix.Socket do
end

@doc """
Configure Absinthe options for a socket
Configure Absinthe options for a socket.
## Examples
```
def connect(params, socket) do
current_user = current_user(params)
socket = Absinthe.Phoenix.Socket.put_options(socket, context: %{
current_user: current_user
})
{:ok, socket}
end
def connect(params, socket) do
current_user = current_user(params)
socket = Absinthe.Phoenix.Socket.put_options(socket, context: %{
current_user: current_user
})
{:ok, socket}
end
defp current_user(%{"user_id" => id}) do
MyApp.Repo.get(User, id)
end
defp current_user(%{"user_id" => id}) do
MyApp.Repo.get(User, id)
end
```
"""
@spec put_options(Phoenix.Socket.t(), Absinthe.run_opts()) :: Phoenix.Socket.t()
def put_options(socket, opts) do
Expand All @@ -79,11 +78,10 @@ defmodule Absinthe.Phoenix.Socket do
end

@doc """
Configure the schema for a socket
Only use this if you are not yet on Phoenix 1.3. If you're on Phoenix 1.3, read the moduledocs.
Configure the schema for a socket.
Only use this if you are not yet on Phoenix 1.3. If you're on Phoenix 1.3,
read the moduledocs.
"""
@spec put_schema(Phoenix.Socket.t(), Absinthe.Schema.t()) :: Phoenix.Socket.t()
def put_schema(socket, schema) do
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phoenix/subscription_test.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Absinthe.Phoenix.SubscriptionTest do
@moduledoc """
Convenience functions for subscription tests
Convenience functions for subscription tests.
"""

@typep opts ::
Expand Down
43 changes: 34 additions & 9 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule Absinthe.Phoenix.Mixfile do
use Mix.Project

@source_url "https://github.com/absinthe-graphql/absinthe_phoenix"
@version "2.0.1"

def project do
Expand All @@ -9,26 +10,32 @@ defmodule Absinthe.Phoenix.Mixfile do
version: @version,
elixir: "~> 1.10",
elixirc_paths: elixirc_paths(Mix.env()),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
docs: [source_ref: "v#{@version}"],
package: package(),
deps: deps()
deps: deps(),
docs: docs()
]
end

defp package do
[
description:
"Subscription support via Phoenix for Absinthe, the GraphQL implementation for Elixir.",
files: ["lib", "mix.exs", "README*"],
files: [
"lib",
"mix.exs",
"README.md",
"CHANGELOG.md",
"CONTRIBUTING.md",
"CODE_OF_CONDUCT.md",
"LICENSE.md"
],
maintainers: ["Ben Wilson", "Bruce Williams"],
licenses: ["MIT"],
links: %{
Website: "https://absinthe-graphql.org",
Changelog:
"https://github.com/absinthe-graphql/absinthe_phoenix/blob/master/CHANGELOG.md",
GitHub: "https://github.com/absinthe-graphql/absinthe_phoenix"
Changelog: "https://hexdocs.pm/absinthe_phoenix/changelog.html",
GitHub: @source_url
}
]
end
Expand All @@ -37,7 +44,9 @@ defmodule Absinthe.Phoenix.Mixfile do
defp elixirc_paths(_), do: ["lib"]

def application do
[extra_applications: [:logger]]
[
extra_applications: [:logger]
]
end

defp deps do
Expand All @@ -48,8 +57,24 @@ defmodule Absinthe.Phoenix.Mixfile do
{:phoenix, "~> 1.5"},
{:phoenix_pubsub, "~> 2.0"},
{:phoenix_html, "~> 2.13", optional: true},
{:ex_doc, "~> 0.14", only: :dev},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:jason, "~> 1.0", only: [:dev, :test]}
]
end

defp docs do
[
extras: [
"CHANGELOG.md",
"CONTRIBUTING.md",
"CODE_OF_CONDUCT.md",
"LICENSE.md": [title: "License"],
"README.md": [title: "Overview"]
],
main: "readme",
source_url: @source_url,
source_ref: "v#{@version}",
formatters: ["html"]
]
end
end
10 changes: 6 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
"absinthe_plug": {:hex, :absinthe_plug, "1.5.0", "018ef544cf577339018d1f482404b4bed762e1b530c78be9de4bbb88a6f3a805", [:mix], [{:absinthe, "~> 1.5.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.2 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "4c160f4ce9a1233a4219a42de946e4e05d0e8733537cd5d8d20e7d4ef8d4b7c7"},
"decimal": {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"},
"earmark": {:hex, :earmark, "1.4.4", "4821b8d05cda507189d51f2caeef370cf1e18ca5d7dfb7d31e9cafe6688106a4", [:mix], [], "hexpm", "1f93aba7340574847c0f609da787f0d79efcab51b044bb6e242cae5aca9d264d"},
"ex_doc": {:hex, :ex_doc, "0.22.0", "fb0495cd70849bc4d7bc716d4e740aebfaddb77bb1074addf357912468c831d6", [:mix], [{:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f9b36237b220c8262d561489967b6a604832593f0dc1fb1608662909457e91aa"},
"earmark_parser": {:hex, :earmark_parser, "1.4.12", "b245e875ec0a311a342320da0551da407d9d2b65d98f7a9597ae078615af3449", [:mix], [], "hexpm", "711e2cc4d64abb7d566d43f54b78f7dc129308a63bc103fbd88550d2174b3160"},
"ex_doc": {:hex, :ex_doc, "0.24.1", "15673de99154f93ca7f05900e4e4155ced1ee0cd34e0caeee567900a616871a4", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "07972f17bdf7dc7b5bd76ec97b556b26178ed3f056e7ec9288eb7cea7f91cce2"},
"jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"},
"makeup": {:hex, :makeup, "1.0.1", "82f332e461dc6c79dbd82fbe2a9c10d48ed07146f0a478286e590c83c52010b5", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "49736fe5b66a08d8575bf5321d716bac5da20c8e6b97714fec2bcd6febcfa1f8"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"},
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm", "6cbe761d6a0ca5a31a0931bf4c63204bceb64538e664a8ecf784a9a6f3b875f1"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm", "5c040b8469c1ff1b10093d3186e2e10dbe483cd73d79ec017993fb3985b8a9b3"},
"phoenix": {:hex, :phoenix, "1.5.1", "95156589879dc69201d5fc0ebdbfdfc7901a09a3616ea611ec297f81340275a2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc272b38e79d2881790fccae6f67a9fbe9b790103d6878175ea03d23003152eb"},
"phoenix_html": {:hex, :phoenix_html, "2.14.2", "b8a3899a72050f3f48a36430da507dd99caf0ac2d06c77529b1646964f3d563e", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "58061c8dfd25da5df1ea0ca47c972f161beb6c875cd293917045b92ffe1bf617"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
Expand Down

0 comments on commit 3488b43

Please sign in to comment.