This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
forked from commanded/eventstore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
154 lines (137 loc) · 4.2 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
defmodule EventStore.Mixfile do
use Mix.Project
@version "0.15.1"
def project do
[
app: :eventstore,
version: @version,
elixir: "~> 1.5",
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
description: description(),
package: package(),
docs: docs(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
consolidate_protocols: Mix.env() == :prod,
aliases: aliases(),
preferred_cli_env: preferred_cli_env(),
dialyzer: dialyzer(),
name: "EventStore",
source_url: "https://github.com/commanded/eventstore"
]
end
def application do
[
extra_applications: [
:logger,
:poolboy
],
mod: {EventStore.Application, []}
]
end
defp elixirc_paths(:bench), do: ["lib", "test/support", "test/subscriptions/support"]
defp elixirc_paths(:jsonb), do: ["lib", "test/support", "test/subscriptions/support"]
defp elixirc_paths(:distributed), do: ["lib", "test/support", "test/subscriptions/support"]
defp elixirc_paths(:local), do: ["lib", "test/support", "test/subscriptions/support"]
defp elixirc_paths(:test), do: ["lib", "test/support", "test/subscriptions/support"]
defp elixirc_paths(_), do: ["lib"]
defp deps do
[
{:fsm, "~> 0.3"},
{:gen_stage, "~> 0.14"},
{:poolboy, "~> 1.5"},
{:postgrex, "~> 0.13"},
{:elixir_uuid, "~> 1.2"},
# Test & release tooling
{:benchfella, "~> 0.3", only: :bench},
{:credo, "~> 0.10", only: [:dev, :test]},
{:dialyxir, "~> 0.5", only: [:dev, :test]},
{:ex_doc, "~> 0.19", only: :dev},
{:markdown, github: "devinus/markdown", only: :dev},
{:mix_test_watch, "~> 0.9", only: :dev},
{:poison, "~> 2.2 or ~> 3.0 or ~> 4.0", optional: true}
]
end
defp description do
"""
EventStore using PostgreSQL for persistence.
"""
end
defp docs do
[
main: "EventStore",
canonical: "http://hexdocs.pm/eventstore",
source_ref: "v#{@version}",
extra_section: "GUIDES",
extras: [
"guides/Getting Started.md",
"guides/Usage.md",
"guides/Subscriptions.md",
"guides/Cluster.md",
"guides/Event Serialization.md",
"guides/Upgrades.md",
"CHANGELOG.md"
]
]
end
defp package do
[
files: ["lib", "priv", "guides", "mix.exs", "README*", "LICENSE*"],
maintainers: ["Ben Smith"],
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/commanded/eventstore",
"Docs" => "https://hexdocs.pm/eventstore/"
}
]
end
defp aliases do
[
"event_store.setup": ["event_store.create", "event_store.init"],
"event_store.reset": ["event_store.drop", "event_store.setup"],
"es.setup": ["event_store.setup"],
"es.reset": ["event_store.reset"],
benchmark: ["es.reset", "app.start", "bench"],
"test.all": ["test.registries", "test.jsonb", "test --only slow"],
"test.jsonb": &test_jsonb/1,
"test.registries": &test_registries/1,
"test.distributed": &test_distributed/1,
"test.local": &test_local/1
]
end
defp preferred_cli_env do
[
"test.all": :test,
"test.jsonb": :test,
"test.registries": :test,
"test.distributed": :test,
"test.local": :test
]
end
defp dialyzer do
[
plt_add_apps: [:poison, :ex_unit],
plt_add_deps: :app_tree,
plt_file: {:no_warn, "priv/plts/eventstore.plt"}
]
end
defp test_jsonb(args), do: test_env(:jsonb, args)
defp test_registries(args), do: Enum.map([:local, :distributed], &test_env(&1, args))
defp test_distributed(args), do: test_env(:distributed, args)
defp test_local(args), do: test_env(:local, 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, " ")}")
{_, res} =
System.cmd(
"mix",
["test" | test_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