forked from tompave/fun_with_flags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
200 lines (175 loc) · 5.58 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
defmodule FunWithFlags.Mixfile do
use Mix.Project
@version "1.0.0"
def project do
[
app: :fun_with_flags,
source_url: "https://github.com/tompave/fun_with_flags",
version: @version,
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps(),
description: description(),
package: package(),
docs: docs(),
aliases: aliases(),
]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
# Specify extra applications you'll use from Erlang/Elixir
[extra_applications: extra_applications(Mix.env),
mod: {FunWithFlags.Application, []}]
end
defp extra_applications(:test), do: local_extra_applications()
defp extra_applications(:dev), do: local_extra_applications()
defp extra_applications(_), do: [:logger]
# When working locally with the Ecto adapter, start the postgrex
# application. It's not started automatically because it's
# optional, I think.
#
defp local_extra_applications do
if System.get_env("PERSISTENCE") == "ecto" do
[:logger, :ecto, :postgrex]
else
[:logger]
end
end
# Dependencies can be Hex packages:
#
# {:my_dep, "~> 0.3.0"}
#
# Or git/path repositories:
#
# {:my_dep, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
#
# Type "mix help deps" for more examples and options
defp deps do
[
{:ex_doc, "~> 0.16", only: :dev},
{:mock, "~> 0.2", only: :test},
{:redix, "~> 0.6", optional: true},
{:ecto_sql, "~> 3.0", optional: true},
{:ecto, "~> 3.0", optional: true},
{:postgrex, "~> 0.13", optional: true, only: [:dev, :test]},
{:redix_pubsub, "~> 0.4", optional: true},
{:phoenix_pubsub, "~> 1.0", optional: true},
{:credo, "~> 0.9.0-rc6", only: :dev, runtime: false},
]
end
defp aliases do
[
{:"test.all", [
&run_tests__redis_pers__redis_pubsub/1, &run_integration_tests__redis_pers__redis_pubsub__no_cache/1,
&run_tests__redis_pers__phoenix_pubsub/1, &run_integration_tests__redis_pers__phoenix_pubsub__no_cache/1,
&run_tests__ecto_pers__phoenix_pubsub/1, &run_integration_tests__ecto_pers__phoenix_pubsub__no_cache/1,
]},
{:"test.phx", [&run_tests__redis_pers__phoenix_pubsub/1]},
{:"test.ecto", [&run_tests__ecto_pers__phoenix_pubsub/1]},
]
end
# Run the tests with Redis as persistent store and Redis PubSub as broker.
#
# Cache enabled, force re-compilation.
#
defp run_tests__redis_pers__redis_pubsub(_) do
Mix.shell.cmd(
"mix test --color --force --exclude phoenix_pubsub --exclude ecto_persistence",
env: [
{"CACHE_ENABLED", "true"},
]
)
end
# Runs the integration tests only.
# Cache disabled, Redis as persistent store and Redis PubSub as broker.
#
defp run_integration_tests__redis_pers__redis_pubsub__no_cache(_) do
Mix.shell.cmd(
"mix test --color --force --only integration",
env: [
{"CACHE_ENABLED", "false"},
]
)
end
# Run the tests with Redis as persistent store and Phoenix.PubSub as broker.
#
defp run_tests__redis_pers__phoenix_pubsub(_) do
Mix.shell.cmd(
"mix test --color --force --no-start --exclude redis_pubsub --exclude ecto_persistence --exclude phoenix_pubsub:with_ecto --include phoenix_pubsub:with_redis --include phoenix_pubsub:true",
env: [
{"CACHE_ENABLED", "true"},
{"PUBSUB_BROKER", "phoenix_pubsub"},
]
)
end
# Runs the integration tests only.
# Cache disabled, Redis as persistent store and Phoenix.PubSubas broker.
#
defp run_integration_tests__redis_pers__phoenix_pubsub__no_cache(_) do
Mix.shell.cmd(
"mix test --color --force --no-start --only integration",
env: [
{"CACHE_ENABLED", "false"},
{"PUBSUB_BROKER", "phoenix_pubsub"},
]
)
end
# Run the tests with Ecto as persistent store and Phoenix.PubSub as broker.
#
defp run_tests__ecto_pers__phoenix_pubsub(_) do
Mix.shell.cmd(
"mix test --color --force --no-start --exclude redis_pubsub --exclude redis_persistence --exclude phoenix_pubsub:with_redis --include phoenix_pubsub:with_ecto --include phoenix_pubsub:true --include ecto_persistence",
env: [
{"CACHE_ENABLED", "true"},
{"PUBSUB_BROKER", "phoenix_pubsub"},
{"PERSISTENCE", "ecto"},
]
)
end
# Runs the integration tests only.
# Cache disabled, Ecto as persistent store and Phoenix.PubSub as broker.
#
defp run_integration_tests__ecto_pers__phoenix_pubsub__no_cache(_) do
Mix.shell.cmd(
"mix test --color --force --no-start --only integration",
env: [
{"CACHE_ENABLED", "false"},
{"PUBSUB_BROKER", "phoenix_pubsub"},
{"PERSISTENCE", "ecto"},
]
)
end
defp elixirc_paths(:test), do: ["lib", "test/support", "dev_support"]
defp elixirc_paths(:dev), do: ["lib", "dev_support"]
defp elixirc_paths(_), do: ["lib"]
defp description do
"""
FunWithFlags, a flexible and fast feature toggle library for Elixir.
"""
end
defp package do
[
maintainers: [
"Tommaso Pavese"
],
licenses: [
"MIT"
],
links: %{
"GitHub" => "https://github.com/tompave/fun_with_flags",
}
]
end
defp docs do
[
extras: ["README.md"],
main: "FunWithFlags",
source_url: "https://github.com/tompave/fun_with_flags/",
source_ref: "v#{@version}"
]
end
end