-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmix.exs
More file actions
68 lines (60 loc) · 1.44 KB
/
mix.exs
File metadata and controls
68 lines (60 loc) · 1.44 KB
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
defmodule Wok.Mixfile do
use Mix.Project
def project do
[
app: :wok,
version: "0.7.2",
elixir: "~> 1.2",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps(),
aliases: aliases()
]
end
def application do
[
applications: [:syntax_tools, :compiler, :crypto, :goldrush, :lager],
env: [],
mod: {:wok_app, []}
]
end
defp deps do
[
{:lager, "~> 3.2.0"},
{:lager_json_formatter, "~> 0.2.2"},
{:kafe, "~> 2.2.1"},
{:bucs, "~> 1.0.6"},
{:doteki, "~> 1.0.5"},
{:uuid, git: "https://github.com/botsunit/erlang-uuid.git", tag: "0.7.2"},
{:metrics, "~> 2.2.0"}
]
end
defp aliases do
[compile: &compile_with_hooks/1]
end
defp compile_with_hooks(args) do
pre_compile_hooks()
result = Mix.Task.run("compile", args)
post_compile_hooks()
result
end
defp pre_compile_hooks() do
run_hook_cmd [
]
end
defp post_compile_hooks() do
run_hook_cmd [
]
end
defp run_hook_cmd(commands) do
{_, os} = :os.type
for command <- commands, do: (fn
({regex, cmd}) ->
if Regex.match?(Regex.compile!(regex), Atom.to_string(os)) do
Mix.Shell.cmd cmd, [], fn(x) -> Mix.Shell.IO.info(String.strip(x)) end
end
(cmd) ->
Mix.Shell.cmd cmd, [], fn(x) -> Mix.Shell.IO.info(String.strip(x)) end
end).(command)
end
end