Skip to content

Commit

Permalink
Publish to hex
Browse files Browse the repository at this point in the history
  • Loading branch information
adriankumpf committed Apr 29, 2018
1 parent dd5ee01 commit c22a197
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 5 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ In order to compile a recent version of `rust` must be installed (tested with 1.

### Installation

**Note:** this package is still in beta and thus not yet available on Hex.

Add `:arb` to your list of dependencies:

```elixir
Expand Down
9 changes: 8 additions & 1 deletion lib/arb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Arb do
def activate(_ids, _opts), do: {:error, :invalid_args}

@doc """
Returns ids of active relays.
Returns the ids of active relays.
## Examples
Expand All @@ -47,6 +47,13 @@ defmodule Arb do
@doc """
Resets the relay board.
If, under some circumstances, relay board operations fail due to a USB error
e.g. `{:error, {:usb, "Input/Output Error"}}`, this function may resolve
the issue by reseting the relay board. The effect is similar to replugging
the device.
**Note:** Previously activated relays stay active.
## Examples
iex> Arb.reset()
Expand Down
4 changes: 4 additions & 0 deletions lib/arb/native.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
defmodule Arb.Native.Options do
@moduledoc false

@type t :: [port: nil | integer, verify: boolean]

defstruct port: nil, verify: true
end

defmodule Arb.Native do
@moduledoc false

use Rustler, otp_app: :arb, crate: "arb"

def activate(_ids, _opts), do: error()
Expand Down
39 changes: 37 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ defmodule Arb.MixProject do
start_permanent: Mix.env() == :prod,
compilers: [:rustler] ++ Mix.compilers(),
rustler_crates: rustler_crates(),
deps: deps()
deps: deps(),
description: description(),
package: package(),
docs: docs(),
source_url: "https://github.com/adriankumpf/arb-ex"
]
end

Expand All @@ -24,7 +28,38 @@ defmodule Arb.MixProject do

defp deps do
[
{:rustler, "~> 0.16.0"}
{:rustler, "~> 0.16.0"},
{:ex_doc, "~> 0.16", only: :dev, runtime: false}
]
end

defp description() do
"""
An Elixir NIF for controlling the ABACOM CH341A relay board.
"""
end

defp package() do
[
files: [
"lib",
"priv",
"native/arb/src",
"native/arb/Cargo*",
"mix.exs",
"README*",
"LICENSE*"
],
maintainers: ["Adrian Kumpf"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/adriankumpf/arb-ex"}
]
end

defp docs do
[
main: "Arb",
extras: ["README.md"]
]
end
end
2 changes: 2 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%{
"earmark": {:hex, :earmark, "1.2.5", "4d21980d5d2862a2e13ec3c49ad9ad783ffc7ca5769cf6ff891a4553fbaae761", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.18.3", "f4b0e4a2ec6f333dccf761838a4b253d75e11f714b85ae271c9ae361367897b7", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
"rustler": {:hex, :rustler, "0.16.0", "9b04237d2e7b30fcae40a28edb56f59aad8f4e3c8790f4996b5f200f649964be", [:mix], [], "hexpm"},
}

0 comments on commit c22a197

Please sign in to comment.