Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,25 @@ Diffo is especially suited for use in organisations with loosely coupled 'entity

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `diffo` to your list of dependencies in `mix.exs`:
The recommended way to install Diffo is with [Igniter](https://hexdocs.pm/igniter):

```bash
mix igniter.install diffo
```

This will add the dependency, configure Neo4j (via `ash_neo4j`), register the custom expression, and set up the Spark formatter.

Alternatively, add `diffo` to your list of dependencies in `mix.exs` manually:

```elixir
def deps do
[
{:diffo, "~> 0.1.6"}
{:diffo, "~> 0.2.1"}
]
end
```

You should need [Neo4j](https://github.com/neo4j/neo4j) available. We recommend the Neo4j Community 5 latest, available at [Neo4j Deploymnent Centre](https://neo4j.com/deployment-center/) which can be installed locally. You can also configure connection to a cloud based database service such as [Neo4j AuraDB](https://neo4j.com/product/auradb/).
You will need [Neo4j](https://github.com/neo4j/neo4j) available. We recommend the Neo4j Community 5 latest, available at [Neo4j Deploymnent Centre](https://neo4j.com/deployment-center/) which can be installed locally. You can also configure connection to a cloud based database service such as [Neo4j AuraDB](https://neo4j.com/product/auradb/).

## Tutorial

Expand Down
79 changes: 79 additions & 0 deletions lib/mix/tasks/diffo.install.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# SPDX-FileCopyrightText: 2025 diffo contributors <https://github.com/diffo-dev/diffo/graphs.contributors>
#
# SPDX-License-Identifier: MIT

defmodule Mix.Tasks.Diffo.Install.Docs do
@moduledoc false

def short_doc, do: "Installs Diffo"
def example, do: "mix igniter.install diffo"

def long_doc do
"""
#{short_doc()}

## Example

```bash
#{example()}
```
"""
end
end

if Code.ensure_loaded?(Igniter) do
defmodule Mix.Tasks.Diffo.Install do
@shortdoc "#{__MODULE__.Docs.short_doc()}"
@moduledoc __MODULE__.Docs.long_doc()

use Igniter.Mix.Task

@impl Igniter.Mix.Task
def info(_argv, _composing_task) do
%Igniter.Mix.Task.Info{
group: :ash,
installs: [{:ash_neo4j, "~> 0.5"}],
example: __MODULE__.Docs.example()
}
end

@impl Igniter.Mix.Task
def igniter(igniter) do
igniter
|> Igniter.Project.Formatter.import_dep(:diffo)
|> Spark.Igniter.prepend_to_section_order(
:"Ash.Resource",
[:specification, :features, :characteristics]
)
|> Igniter.Project.Config.configure(
"config.exs",
:ash,
[:custom_expressions],
[Diffo.Unwrap.AshCustomExpression],
updater: fn zipper ->
Igniter.Code.List.prepend_new_to_list(
zipper,
quote(do: Diffo.Unwrap.AshCustomExpression)
)
end
)
end
end
else
defmodule Mix.Tasks.Diffo.Install do
@shortdoc "#{__MODULE__.Docs.short_doc()} | Install `igniter` to use"
@moduledoc __MODULE__.Docs.long_doc()

use Mix.Task

def run(_argv) do
Mix.shell().error("""
The task 'diffo.install' requires igniter. Please install igniter and try again.

For more information, see: https://hexdocs.pm/igniter/readme.html#installation
""")

exit({:shutdown, 1})
end
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ defmodule Diffo.MixProject do
{:ash_outstanding, "~> 0.2.3"},
{:ash_jason, "~> 3.0"},
{:ash_state_machine, "~> 0.2.12"},
{:ash_neo4j, ash_neo4j_version("~> 0.4.1")},
{:ash_neo4j, ash_neo4j_version("~> 0.5")},
{:bolty, ">= 0.0.12"},
{:ash, ash_version("~> 3.0 and >= 3.24.2")},
{:uuid, "~> 1.1"},
Expand Down
Loading