-
Notifications
You must be signed in to change notification settings - Fork 15
/
mix.exs
82 lines (73 loc) · 1.8 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
# examples_generator.exs is needed only for docs and is not shipped in package
if File.exists?("examples_generator.exs") do
Code.compile_file("examples_generator.exs")
else
defmodule Ecto.ERD.ExamplesGenerator do
def projects, do: []
def run(_), do: :noop
end
end
defmodule Ecto.ERD.MixProject do
use Mix.Project
@source_url "https://github.com/fuelen/ecto_erd/"
@version "0.6.2"
def project do
[
app: :ecto_erd,
version: @version,
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps(),
package: package(),
description: description(),
name: "Ecto ERD",
docs: docs(),
aliases: [docs: [&generate_examples/1, "docs"]],
dialyzer: [plt_add_apps: [:mix]]
]
end
defp description do
"ERD generator for Ecto users"
end
defp docs do
[
main: "Mix.Tasks.Ecto.Gen.Erd",
extras:
Enum.map(Ecto.ERD.ExamplesGenerator.projects(), fn project ->
{:"tmp/docs/#{project}.md", [title: project]}
end),
source_url: @source_url,
source_ref: "v#{@version}",
groups_for_extras: [
Examples: ~r"tmp/docs/"
]
]
end
defp package do
[
licenses: ["Apache-2.0"],
links: %{
GitHub: @source_url
}
]
end
def application do
[
extra_applications: [:logger]
]
end
defp generate_examples(_) do
run? = "Generate examples? y/n: " |> IO.gets() |> String.trim() |> String.downcase() == "y"
if run? do
Ecto.ERD.ExamplesGenerator.run(Path.join([@source_url, "blob", "v#{@version}"]))
end
end
defp deps do
[
{:ex_doc, "~> 0.24", only: :dev, runtime: false},
{:html_entities, "~> 0.5"},
{:ecto, "~> 3.12"},
{:dialyxir, "~> 1.0", only: [:dev], runtime: false}
]
end
end