forked from Dkendal/battle_snake
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmix.exs
143 lines (128 loc) · 3.47 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
defmodule Bs.Mixfile do
use Mix.Project
@version String.trim(File.read!("VERSION"))
def project do
[
aliases: aliases(),
app: :bs,
build_embedded: Mix.env() == :prod,
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
deps: deps(),
dialyzer: dialyzer(),
name: "BattleSnake",
docs: [
main: "Bs",
extras: ["README.md"]
],
elixir: "~> 1.6",
elixirc_paths: elixirc_paths(Mix.env()),
erlc_options: erlc_options(Mix.env()),
homepage_url: "https://github.com/battle-snake/battle_snake",
preferred_cli_env: preferred_cli_env(),
source_url: "https://github.com/battle-snake/battle_snake",
start_permanent: Mix.env() == :prod,
test_coverage: [tool: ExCoveralls],
version: @version
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {Bs, []},
extra_applications: extra_applications(Mix.env())
]
end
def erlc_options(_all) do
[:debug_info]
end
def extra_applications(:dev) do
[:mix | extra_applications(:all)]
end
def extra_applications(_all) do
[:logger, :ecto_mnesia, :confex]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
def preferred_cli_env do
[
vcr: :test,
"vcr.delete": :test,
"vcr.check": :test,
"vcr.show": :test,
coveralls: :test,
release: :prod,
test: :test,
vcr: :test
]
end
defp deps do
[
{:apex, "~> 1.2", only: [:dev]},
{:confex, "~> 3.3.1"},
{:cowboy, "~> 1.0"},
{:credo, "~> 0.8", only: [:dev, :text], runtime: false},
{:dialyxir, "~> 0.5", only: [:dev], runtime: false},
{:distillery, "~> 1.5", runtime: false},
{:ecto, "~> 2.1"},
{:ecto_mnesia, github: "Nebo15/ecto_mnesia", ref: "592cc472"},
{:edeliver, "~> 1.4"},
{:ex_doc, "~> 0.16", only: :dev, runtime: false},
{:ex_machina, "~> 2.1", only: :test},
{:excoveralls, "~> 0.6", only: :test},
{:exvcr, "~> 0.8", only: :test, runtime: false},
{:gettext, "~> 0.11"},
{:httpoison, "~> 0.11"},
{:meck, "~> 0.8.8", only: :test},
{:mox, "~> 0.3", only: :test},
{:phoenix, "~> 1.3"},
{:phoenix_ecto, "~> 3.0"},
{:phoenix_html, "~> 2.9"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:phoenix_pubsub, "~> 1.0"},
{:poison, "~> 3.0"},
{:postgrex, ">= 0.0.0"},
{:proper, github: "manopapad/proper", tag: "v1.2", only: :test}
]
end
defp dialyzer do
[plt_add_deps: :transitive, plt_add_apps: [:mnesia]]
end
defp aliases do
exclusions =
[
"lib/bs.ex",
"lib/bs_web.ex",
"lib/bs_web/gettext.ex",
"lib/bs_web/router.ex",
"lib/bs_web/views/error_helpers.ex"
]
|> Enum.map(&("--exclude " <> &1))
|> Enum.join(" ")
[
"bs.watch": &watch/1,
"bs.graph": [
"xref graph --format dot #{exclusions}",
&xref/1
]
]
end
def test _ do
"MIX_ENV=test mix test"
|> Mix.shell().cmd()
end
def xref(_) do
"dot xref_graph.dot -Tsvg -o xref_graph.svg"
|> Mix.shell().cmd()
end
def watch(_) do
"""
watchman-make -p 'lib/**/*.ex' \
'test/**/*.ex' \ 'test/**/*.exs' \
--run 'mix test --stale --color=true'
"""
|> Mix.shell().cmd()
end
end