This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
forked from tompave/fun_with_flags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
233 lines (206 loc) · 6.97 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
defmodule FunWithFlags.Mixfile do
use Mix.Project
@version "1.4.0"
def project do
[
app: :fun_with_flags,
source_url: "https://github.com/tompave/fun_with_flags",
version: @version,
elixir: "~> 1.6",
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 ecto_sql
# and postgrex applications. They're not started automatically
# because they're optional, I think.
#
defp local_extra_applications do
if System.get_env("PERSISTENCE") == "ecto" do
[:logger, :ecto, :ecto_sql, :postgrex]
else
[:logger, :redix]
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.21", only: :dev},
{:mock, "~> 0.3", only: :test},
{:redix, "~> 0.9", optional: true},
{:ecto_sql, "~> 3.0", optional: true},
{:postgrex, "~> 0.13", optional: true, only: [:dev, :test]},
{:myxql, "~> 0.2", optional: true, only: [:dev, :test]},
{:phoenix_pubsub, "~> 1.0", optional: true},
{:credo, "~> 1.1", 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_postgres__phoenix_pubsub/1, &run_integration_tests__ecto_pers_postgres__phoenix_pubsub__no_cache/1,
&run_tests__ecto_pers_mysql__phoenix_pubsub/1, &run_integration_tests__ecto_pers_mysql__phoenix_pubsub__no_cache/1,
]},
{:"test.phx", [&run_tests__redis_pers__phoenix_pubsub/1]},
{:"test.ecto.postgres", [&run_tests__ecto_pers_postgres__phoenix_pubsub/1]},
{:"test.ecto.mysql", [&run_tests__ecto_pers_mysql__phoenix_pubsub/1]},
{:"test.redis", [&run_tests__redis_pers__redis_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+PostgreSQL as persistent store and Phoenix.PubSub as broker.
#
defp run_tests__ecto_pers_postgres__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"},
{"RDBMS", "postgres"},
]
)
end
# Run the tests with Ecto+MySQL as persistent store and Phoenix.PubSub as broker.
#
defp run_tests__ecto_pers_mysql__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"},
{"RDBMS", "mysql"},
]
)
end
# Runs the integration tests only.
# Cache disabled, Ecto+PostgreSQL as persistent store and Phoenix.PubSub as broker.
#
defp run_integration_tests__ecto_pers_postgres__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"},
{"RDBMS", "postgres"},
]
)
end
# Runs the integration tests only.
# Cache disabled, Ecto+MySQL as persistent store and Phoenix.PubSub as broker.
#
defp run_integration_tests__ecto_pers_mysql__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"},
{"RDBMS", "mysql"},
]
)
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