-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmix.exs
121 lines (108 loc) · 3.01 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
defmodule Crux.Structs.MixProject do
use Mix.Project
@vsn "0.3.0-dev"
@name :crux_structs
def project() do
[
start_permanent: Mix.env() == :prod,
package: package(),
app: @name,
version: @vsn,
elixir: "~> 1.10",
description: "Library providing Discord API structs for crux.",
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}/",
"Crux Libraries Overview" => "https://github.com/SpaceEEC/crux/"
}
]
end
def application(), do: []
defp deps() do
[
{:ex_doc, "~> 0.23", only: :dev, runtime: false},
{:credo, "~> 1.5.0-rc.2", only: [:dev, :test], runtime: false},
{:jason, ">= 0.0.0", only: [:dev, :test], runtime: false}
]
end
defp aliases() do
[
docs: ["docs", &generate_config/1]
]
end
defp docs() do
[
groups_for_modules: [
Discord: [
Crux.Structs.Application,
Crux.Structs.Attachment,
Crux.Structs.AuditLog,
Crux.Structs.AuditLogChange,
Crux.Structs.AuditLogEntry,
Crux.Structs.Channel,
Crux.Structs.Embed,
Crux.Structs.Emoji,
Crux.Structs.Guild,
Crux.Structs.GuildPreview,
Crux.Structs.Integration,
Crux.Structs.Invite,
Crux.Structs.Member,
Crux.Structs.Message,
Crux.Structs.Overwrite,
Crux.Structs.Presence,
Crux.Structs.Reaction,
Crux.Structs.Role,
Crux.Structs.Sticker,
Crux.Structs.Template,
Crux.Structs.User,
Crux.Structs.VoiceRegion,
Crux.Structs.VoiceState,
Crux.Structs.Webhook
],
BitFields: [
Crux.Structs.Guild.SystemChannelFlags,
Crux.Structs.Intents,
Crux.Structs.Message.Flags,
Crux.Structs.Permissions,
Crux.Structs.Presence.ActivityFlags,
Crux.Structs.User.Flags
],
Utility: ~r/.+/
],
nest_modules_by_prefix: [
Crux.Structs
],
formatters: ["html"]
]
end
def generate_config(_) do
{data, 0} = System.cmd("git", ["tag"])
config =
data
|> String.trim()
|> String.split("\n")
|> Enum.map(&%{"url" => "https://hexdocs.pm/#{@name}/" <> &1, "version" => &1})
|> Enum.reverse()
|> Jason.encode!()
config = "var versionNodes = " <> config
path =
[__DIR__, "doc", "docs_config.js"]
|> Path.join()
|> Path.expand()
File.write!(path, config)
Mix.Shell.IO.info(~s{Generated "#{path}".})
end
end