-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmix.exs
101 lines (86 loc) · 2.29 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
defmodule Commanded.Middleware.Auditing.Mixfile do
use Mix.Project
@version "1.0.0"
def project do
[
app: :commanded_audit_middleware,
version: @version,
elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mix.env()),
description: description(),
package: package(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
aliases: aliases(),
preferred_cli_env: preferred_cli_env()
]
end
def application do
[
extra_applications: [:logger],
mod: {Commanded.Middleware.Auditing.Application, []}
]
end
defp description do
"""
Command auditing middleware for Commanded CQRS/ES applications
"""
end
defp package do
[
files: ["lib", "priv", "mix.exs", "README*", "LICENSE*"],
maintainers: ["Ben Smith"],
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/commanded/commanded-audit-middleware"
}
]
end
defp deps do
[
{:commanded, "~> 1.0", runtime: false},
{:ecto, "~> 3.3"},
{:ecto_sql, "~> 3.3"},
{:elixir_uuid, "~> 1.2"},
{:ex_doc, ">= 0.0.0", only: :dev},
{:jason, "~> 1.1"},
{:postgrex, "~> 0.15"}
]
end
defp elixirc_paths(env) when env in [:jsonb, :test], do: ["lib", "test/support"]
defp elixirc_paths(_env), do: ["lib"]
defp aliases do
[
"ecto.setup": ["ecto.create", "ecto.migrate"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.reset --quiet", "test"],
"test.all": ["test", "test.jsonb"],
"test.jsonb": &test_jsonb/1
]
end
defp preferred_cli_env do
[
"test.all": :test,
"test.jsonb": :test
]
end
defp test_jsonb(args), do: test_env(:jsonb, args)
defp test_env(env, args) do
test_args = if IO.ANSI.enabled?(), do: ["--color" | args], else: ["--no-color" | args]
IO.puts("==> Running tests for MIX_ENV=#{env} mix test #{Enum.join(args, " ")}")
run_mix_task(env, ["test" | test_args])
end
defp run_mix_task(env, args) do
{_, res} =
System.cmd(
"mix",
args,
into: IO.binstream(:stdio, :line),
env: [{"MIX_ENV", to_string(env)}]
)
if res > 0 do
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
end
end
end