forked from elixir-ecto/ecto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
91 lines (75 loc) · 2.62 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
defmodule Ecto.Mixfile do
use Mix.Project
@version "1.1.0-dev"
@adapters [:pg, :mysql]
@pools [:poolboy, :sojourn_timeout, :sojourn_codel]
def project do
[app: :ecto,
version: @version,
elixir: "~> 1.0",
deps: deps,
build_per_environment: false,
test_paths: test_paths(Mix.env),
# Custom testing
aliases: ["test.all": ["test", "test.pools", "test.adapters"],
"test.pools": &test_pools/1,
"test.adapters": &test_adapters/1],
preferred_cli_env: ["test.all": :test],
# Hex
description: description,
package: package,
# Docs
name: "Ecto",
docs: [source_ref: "v#{@version}", main: "Ecto",
source_url: "https://github.com/elixir-lang/ecto"]]
end
def application do
[applications: [:logger, :decimal, :poolboy],
env: [json_library: Poison]]
end
defp deps do
[{:poolboy, "~> 1.4"},
{:sbroker, "~> 0.7", optional: true},
{:decimal, "~> 1.0"},
{:postgrex, "~> 0.9.1", optional: true},
{:mariaex, "~> 0.4.1", optional: true},
{:poison, "~> 1.0", optional: true},
{:ex_doc, "~> 0.10", only: :docs},
{:earmark, "~> 0.1", only: :docs},
{:inch_ex, only: :docs}]
end
defp test_paths(adapter) when adapter in @adapters, do: ["integration_test/#{adapter}"]
defp test_paths(pool) when pool in @pools, do: ["test/pool/#{pool(pool)}"]
defp test_paths(_), do: ["test/ecto", "test/mix"]
defp pool(:sojourn_timeout), do: "sojourn_broker"
defp pool(:sojourn_codel), do: "sojourn_broker"
defp pool(:poolboy), do: "poolboy"
defp description do
"""
Ecto is a domain specific language for writing queries and interacting with databases in Elixir.
"""
end
defp package do
[maintainers: ["Eric Meadows-Jönsson", "José Valim"],
licenses: ["Apache 2.0"],
links: %{"GitHub" => "https://github.com/elixir-lang/ecto"},
files: ~w(mix.exs README.md CHANGELOG.md lib) ++
~w(integration_test/cases integration_test/sql integration_test/support)]
end
defp test_pools(args) do
for env <- @pools, do: env_run(env, args)
end
defp test_adapters(args) do
for env <- @adapters, 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