-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
113 lines (101 loc) · 2.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
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
defmodule Crux.Interaction.MixProject do
use Mix.Project
@vsn "0.1.0-dev"
@name :crux_interaction
def project() do
[
start_permanent: Mix.env() == :prod,
package: package(),
app: @name,
version: @vsn,
elixir: "~> 1.10",
description: "",
source_url: "https://github.com/SpaceEEC/#{@name}/",
homepage_url: "https://github.com/SpaceEEC/#{@name}/",
deps: deps(),
aliases: aliases(),
docs: docs()
]
end
def package() do
[
name: @name,
licenses: ["MIT"],
maintainers: ["SpaceEEC"],
links: %{
"GitHub" => "https://github.com/SpaceEEC/#{@name}/",
"Changelog" => "https://github.com/SpaceEEC/#{@name}/releases/tag/#{@vsn}",
"Documentation" => "https://hexdocs.pm/#{@name}/#{@vsn}"
}
]
end
def application() do
[extra_applications: [:logger], mod: {Crux.Interaction.Bpplication, []}]
end
defp deps() do
[
# Optional
{:plug, ">= 0.0.0", optional: true},
{:crux_crypto, github: "SpaceEEC/crux_crypto", optional: true},
{:mimerl, "~> 1.2.0", optional: true},
{:hackney, "~> 1.18.0", optional: true},
# Dev
{:jason, ">= 0.0.0", only: :dev, runtime: false},
{:ex_doc,
github: "SpaceEEC/ex_doc", ref: "fix/module_nesting_duplicate", only: :dev, runtime: false}
]
end
defp aliases() do
[docs: ["docs", &generate_config/1]]
end
defp docs() do
[
nest_modules_by_prefix: [
Crux.Interaction.ApplicationCommand,
Crux.Interaction.ApplicationCommand.Exceptions,
Crux.Interaction.Component,
Crux.Interaction.Plug,
Crux.Interaction.Response
],
groups_for_modules: [
Util: [
Crux.Interaction.Util,
Crux.Interaction.Response,
Crux.Interaction.Executor
],
Plug: [
Crux.Interaction.Plug,
Crux.Interaction.Plug.CacheBodyReader,
Crux.Interaction.Plug.VerifyHeader
]
],
groups_for_functions: [
"Response Wrappers": &(&1[:section] == :response),
"Autocomplete Data": &(&1[:section] == :autocomplete),
"Modal Data": &(&1[:section] == :modal),
"Message Data": &(&1[:section] == :message),
"Shared Data": &(&1[:section] == :multiple)
],
formatter: "html",
source_ref: "trunk"
]
end
def generate_config(_) do
config =
System.cmd("git", ["tag"])
|> elem(0)
|> String.split("\n")
|> Enum.slice(0..-2)
|> Enum.map(&%{"url" => "https://hexdocs.pm/#{@name}/" <> &1, "version" => &1})
|> Enum.reverse()
|> Jason.encode!()
config = "var versionNodes = " <> config
path =
__DIR__
|> Path.split()
|> Kernel.++(["doc", "docs_config.js"])
|> Path.join()
File.write!(path, config)
Mix.Shell.IO.info("Generated #{path}")
end
end