-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
mix.exs
85 lines (76 loc) · 1.88 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
defmodule PhoenixBakery.MixProject do
use Mix.Project
@description File.read!("README.md")
|> String.split(~r/<!--\s*(start|end):PhoenixBakery\s*-->/, parts: 3)
|> Enum.at(1)
|> String.trim()
|> String.split(~r/\n/, parts: 2)
|> List.first()
@github "https://github.com/hauleth/phoenix_bakery"
def project do
version = version()
[
app: :phoenix_bakery,
description: @description,
version: version,
elixir: "~> 1.11",
start_permanent: Mix.env() == :prod,
deps: deps(),
source_url: @github,
docs: [
main: "PhoenixBakery",
source_ref: "v#{version}",
groups_for_modules: [
Compressors: ~r/^PhoenixBakery\./
]
],
package: [
licenses: ~w[MIT],
links: %{
"GitHub" => @github
}
]
]
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
[
{:phoenix, "~> 1.6"},
{:brotli, "~> 0.3.0", optional: true},
{:ezstd, "~> 1.0", optional: true},
{:jason, ">= 0.0.0", only: [:dev, :test]},
{:ex_doc, ">= 0.0.0", only: [:dev]},
{:credo, "~> 1.5", only: [:dev]}
]
end
defp version do
with :error <- hex_version(),
:error <- git_version() do
"0.0.0-dev"
else
{:ok, ver} -> ver
end
end
defp hex_version do
with {:ok, terms} <- :file.consult("hex_metadata.config"),
{"version", version} <- List.keyfind(terms, "version", 0) do
{:ok, version}
else
_ -> :error
end
end
defp git_version do
System.cmd("git", ~w[describe])
else
{"v" <> ver, 0} -> {:ok, String.trim(ver)}
_ -> :error
catch
_, _ -> :error
end
end