Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #43 from smartcitiesdata/update_deps_smart_city
Browse files Browse the repository at this point in the history
Remove Husky, update smart_city dep
  • Loading branch information
kennyatpillar committed Oct 10, 2019
2 parents fb3be42 + 3c89461 commit 9dec1b0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 49 deletions.
19 changes: 16 additions & 3 deletions README.md
Expand Up @@ -2,23 +2,28 @@
[![Hex.pm Version](http://img.shields.io/hexpm/v/smart_city_registry.svg?style=flat)](https://hex.pm/packages/smart_city_registry)

# SmartCity.Registry

A library for publishing and updating SmartCity Dataset and Organization definitions, built on top of Redis PubSub. Used for sharing these definitions amongst microservices.

This library exposes two sets of functionality.
1. Definitions for datasets and organizations, and functions for writing them to and fetching them from Redis PubSub.
2. A subscriber process exposing callbacks that are executed when an update to an organization or dataset is received.

1. Definitions for datasets and organizations, and functions for writing them to and fetching them from Redis PubSub.
2. A subscriber process exposing callbacks that are executed when an update to an organization or dataset is received.

See also: [Redis PubSub](https://redis.io/topics/pubsub)

## Installation

This package can be installed by adding `smart_city_registry` to your list of dependencies in mix.exs:

```elixir
def deps do
[{:smart_city_registry, "~> 5.0.0"}]
[{:smart_city_registry, "~> 5.0.2"}]
end
```

## Basic Usage

```elixir
iex> alias SmartCity.Dataset
iex> dataset = Dataset.new(...)
Expand All @@ -32,13 +37,15 @@ iex> {:ok, dataset} = Dataset.get("some_id")
# Get all datasets
iex> {:ok, datasets} = Dataset.get_all()
```

Organization works basically the same way.

For receiving updates see the [message handler](#message-handler) and [subscriber](#subscriber) sections below.

## Configuration

Configure a Redis host:

```elixir
# config/config.exs or #{env}.exs
config :smart_city_registry,
Expand All @@ -48,7 +55,9 @@ config :smart_city_registry,
```

### Subscriber

Add the subscriber as a child of your application:

```elixir
# application.ex
def start(_type, _args) do
Expand All @@ -62,7 +71,9 @@ end
```

### Message Handler

Implement a message handler module:

```elixir
# lib/your_app/dataset_handler.ex or wherever
defmodule YourApp.DatasetHandler do
Expand All @@ -82,6 +93,7 @@ end
```

## Contributing

1. Fork the repo
2. Make your changes
3. Test your code
Expand All @@ -101,6 +113,7 @@ mix credo
```

### Submit a pull request

Submit a PR from your fork back to the [SmartCities/smart_city_registry](https://github.com/SmartCitiesData/smart_city_registry) repository.

## License
Expand Down
3 changes: 0 additions & 3 deletions config/dev.exs
@@ -1,4 +1 @@
use Mix.Config

config :husky,
pre_commit: "./scripts/git_pre_commit_hook.sh"
7 changes: 3 additions & 4 deletions mix.exs
Expand Up @@ -4,7 +4,7 @@ defmodule SmartCity.Registry.MixProject do
def project do
[
app: :smart_city_registry,
version: "5.0.1",
version: "5.0.2",
elixir: "~> 1.8",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand All @@ -27,7 +27,7 @@ defmodule SmartCity.Registry.MixProject do
defp deps do
[
# Smart City must be unpinned when registry is retired in favor of Discovery API using the event stream
{:smart_city, "2.1.6"},
{:smart_city, "~> 3.1"},
{:jason, "~> 1.1"},
{:redix, "~> 0.9"},
{:dialyxir, "~> 0.5", only: :dev},
Expand All @@ -36,8 +36,7 @@ defmodule SmartCity.Registry.MixProject do
{:divo, "~> 1.1", only: [:dev, :test, :integration]},
{:placebo, "~> 1.2", only: [:dev, :test, :integration]},
{:mix_test_watch, "~> 0.9", only: :dev, runtime: false},
{:checkov, "~> 0.4", only: :test},
{:husky, "~> 1.0", only: :dev, runtime: false}
{:checkov, "~> 0.4", only: :test}
]
end

Expand Down
4 changes: 3 additions & 1 deletion mix.lock
@@ -1,4 +1,5 @@
%{
"brook_serializer": {:hex, :brook_serializer, "2.0.0", "e12e742d6a533b3820615edb9dd33791f68b7233123d8e7a9db77edb29706aa1", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"checkov": {:hex, :checkov, "0.4.0", "a1974a5885f62f8943a9059f0d5252b222271e0e58dd872ffb60323f2e376433", [:mix], [], "hexpm"},
"credo": {:hex, :credo, "1.1.5", "caec7a3cadd2e58609d7ee25b3931b129e739e070539ad1a0cd7efeeb47014f4", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
Expand All @@ -12,11 +13,12 @@
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm"},
"mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"},
"mix_test_watch": {:hex, :mix_test_watch, "0.9.0", "c72132a6071261893518fa08e121e911c9358713f62794a90c95db59042af375", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.1", "c90796ecee0289dbb5ad16d3ad06f957b0cd1199769641c961cfe0b97db190e0", [:mix], [], "hexpm"},
"patiently": {:hex, :patiently, "0.2.0", "67eb139591e10c4b363ae0198e832552f191c58894731efd3bf124ec4722267a", [:mix], [], "hexpm"},
"placebo": {:hex, :placebo, "1.2.2", "a3d47906b01844bfd04ab0351a605620619fdb8f011225e406696f96a88ff380", [:mix], [{:meck, "~> 0.8.13", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"},
"redix": {:hex, :redix, "0.10.2", "a9eabf47898aa878650df36194aeb63966d74f5bd69d9caa37babb32dbb93c5d", [:mix], [{:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"},
"smart_city": {:hex, :smart_city, "2.1.6", "88180173faa62032feddcc427d80465e056c46e8b17609a86633070ff44f86a1", [:mix], [], "hexpm"},
"smart_city": {:hex, :smart_city, "3.1.0", "c086f955fcaedbd808c93ca7b923f7401e28ec33fd51656188d8b2f495b765c3", [:mix], [{:brook_serializer, "~> 2.0", [hex: :brook_serializer, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.3", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"},
"telemetry": {:hex, :telemetry, "0.4.0", "8339bee3fa8b91cb84d14c2935f8ecf399ccd87301ad6da6b71c09553834b2ab", [:rebar3], [], "hexpm"},
}
38 changes: 0 additions & 38 deletions scripts/git_pre_commit_hook.sh

This file was deleted.

0 comments on commit 9dec1b0

Please sign in to comment.