-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
86 lines (75 loc) · 1.93 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
defmodule Crux.Gateway.MixProject do
use Mix.Project
@vsn "0.3.0-dev"
@name :crux_gateway
def project do
[
start_permanent: Mix.env() == :prod,
package: package(),
app: @name,
version: @vsn,
elixir: "~> 1.10",
description: "Package providing a flexible gateway connection to the Discord API.",
source_url: "https://github.com/SpaceEEC/#{@name}/",
homepage_url: "https://github.com/SpaceEEC/#{@name}/",
deps: deps(),
docs: docs(),
aliases: aliases()
]
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}/"
}
]
end
def application do
[extra_applications: [:logger, :inets]]
end
defp deps do
[
{:gen_stage, "~> 1.0"},
{:gun, "~> 1.3"},
{:jason, "~> 1.2", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.23", only: [:dev], runtime: false},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false}
]
end
defp docs() do
[
formatter: "html",
extras: [
"pages/EXAMPLES.md"
]
]
end
defp aliases() do
[
docs: ["docs", &generate_config/1]
]
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
__ENV__.file
|> Path.split()
|> Enum.slice(0..-2)
|> Kernel.++(["doc", "docs_config.js"])
|> Enum.join("/")
|> File.write!(config)
Mix.Shell.IO.info(~S{Generated "doc/docs_config.js".})
end
end