forked from liveforeverx/dlex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
71 lines (61 loc) · 1.81 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
defmodule Dlex.MixProject do
use Mix.Project
def project do
[
app: :dlex,
version: "0.4.1",
elixir: "~> 1.7",
start_permanent: Mix.env() == :prod,
deps: deps(),
description: description(),
package: package(),
aliases: [
"test.all": ["test.http", "test"],
"test.http": &test_http/1
],
preferred_cli_env: ["test.all": :test, "test.http": :test]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:db_connection, "~> 2.1"},
{:grpc, "~> 0.3.1"},
{:jason, "~> 1.0", optional: true},
{:mint, "~> 1.0", optional: true},
{:castore, "~> 0.1.4", optional: true},
{:ecto, "~> 3.1", optional: true},
{:earmark, "~> 1.0", only: :dev},
{:exrun, "~> 0.1.0", only: :dev},
{:ex_doc, "~> 0.19", only: :dev}
]
end
defp description do
"Dlex is a gRPC based client for the Dgraph database."
end
defp package do
[
maintainers: ["Dmitry Russ(Aleksandrov)", "Eric Hagman"],
licenses: ["Apache 2.0"],
links: %{"Github" => "https://github.com/liveforeverx/dlex"}
]
end
defp test_http(args) do
env_run([{"DLEX_ADAPTER", "http"}], args)
end
defp env_run(envs, args) do
args = if IO.ANSI.enabled?(), do: ["--color" | args], else: ["--no-color" | args]
env_line = envs |> Enum.map(fn {key, value} -> "#{key}=#{value}" end) |> Enum.join(" ")
IO.puts("==> Running tests with environments: #{env_line} mix test")
{_, res} = System.cmd("mix", ["test" | args], into: IO.binstream(:stdio, :line), env: envs)
if res > 0 do
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
end
end
end