forked from elixir-ecto/db_connection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
73 lines (61 loc) · 1.95 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
defmodule DBConnection.Mixfile do
use Mix.Project
@pools [:connection, :poolboy, :sojourn, :ownership]
@version "1.0.0-rc.4"
def project do
[app: :db_connection,
version: @version,
elixir: "~> 1.0",
deps: deps(),
docs: docs(),
description: description(),
package: package(),
build_per_environment: false,
consolidate_protocols: false,
test_paths: test_paths(Mix.env),
aliases: ["test.all": ["test", "test.pools"],
"test.pools": &test_pools/1],
xref: [exclude: [:sbroker, :poolboy, :sregulator]],
preferred_cli_env: ["test.all": :test]]
end
def application do
[applications: [:logger, :connection],
mod: {DBConnection.App, []}]
end
defp deps do
[{:connection, "~> 1.0.2"},
{:poolboy, "~> 1.5", [optional: true]},
{:sbroker, "~> 1.0.0-beta.3", [optional: true]},
{:ex_doc, "~> 0.12", only: :dev}]
end
defp docs do
[source_url: "https://github.com/elixir-ecto/db_connection",
source_ref: "v#{@version}",
main: DBConnection]
end
defp description do
"""
Database connection behaviour for database transactions and connection pooling
"""
end
defp package do
%{licenses: ["Apache 2.0"],
maintainers: ["James Fish"],
links: %{"Github" => "https://github.com/elixir-ecto/db_connection"}}
end
defp test_paths(pool) when pool in @pools, do: ["integration_test/#{pool}"]
defp test_paths(_), do: ["test"]
defp test_pools(args) do
for env <- @pools, do: env_run(env, args)
end
defp env_run(env, args) do
args = if IO.ANSI.enabled?, do: ["--color"|args], else: ["--no-color"|args]
IO.puts "==> Running tests for MIX_ENV=#{env} mix test"
{_, res} = System.cmd "mix", ["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