-
-
Notifications
You must be signed in to change notification settings - Fork 105
/
mix.exs
173 lines (155 loc) · 5.45 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
defmodule PromEx.MixProject do
use Mix.Project
def project do
[
app: :prom_ex,
version: "1.11.0",
elixir: "~> 1.14",
name: "PromEx",
source_url: "https://github.com/akoutmos/prom_ex",
homepage_url: "https://hex.pm/packages/prom_ex",
description: "Prometheus metrics and Grafana dashboards for all of your favorite Elixir libraries",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.github": :test
],
dialyzer: [
plt_add_apps: [
:absinthe,
:broadway,
:ecto,
:mix,
:oban,
:phoenix,
:plug,
:telemetry_metrics,
:telemetry_metrics_prometheus_core
],
plt_file: {:no_warn, "priv/plts/dialyzer.plt"}
],
package: package(),
deps: deps(),
docs: docs(),
aliases: aliases()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# Required dependencies
{:jason, "~> 1.4"},
{:finch, "~> 0.18"},
{:telemetry, ">= 1.0.0"},
{:telemetry_poller, "~> 1.1"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_metrics_prometheus_core, "~> 1.2"},
{:peep, "~> 3.0"},
{:octo_fetch, "~> 0.4"},
# Optional dependencies depending on what telemetry events the user is interested in capturing
{:phoenix, ">= 1.7.0", optional: true},
{:phoenix_live_view, ">= 0.20.0", optional: true},
{:plug, ">= 1.16.0", optional: true},
{:plug_cowboy, ">= 2.6.0", optional: true},
{:ecto, ">= 3.11.0", optional: true},
{:oban, ">= 2.10.0", optional: true},
{:absinthe, ">= 1.7.0", optional: true},
{:broadway, ">= 1.1.0", optional: true},
# PromEx development related dependencies
{:bypass, "~> 2.1", only: :test},
{:ex_doc, "~> 0.34.2", only: :dev},
{:excoveralls, "~> 0.18.2", only: :test, runtime: false},
{:doctor, "~> 0.21.0", only: :dev},
{:credo, "~> 1.7.7", only: :dev},
{:dialyxir, "~> 1.4.3", only: :dev, runtime: false}
]
end
defp docs do
[
main: "readme",
source_ref: "master",
logo: "guides/images/logo.svg",
extras: [
"README.md",
"guides/howtos/Writing PromEx Plugins.md",
"guides/howtos/Telemetry.md",
"guides/howtos/Running Multiple Agents.md",
"guides/howtos/Seeding Metrics.md",
"guides/gallery/All.md"
],
groups_for_extras: [
"How-To's": ~r/guides\/howtos\/.?/,
Grafana: ~r/guides\/gallery\/.?/
]
]
end
defp package do
[
name: "prom_ex",
files: ~w(lib priv/grafana_agent priv/*.eex mix.exs README.md LICENSE CHANGELOG.md),
licenses: ["MIT"],
maintainers: ["Alex Koutmos"],
links: %{
"GitHub" => "https://github.com/akoutmos/prom_ex",
"Sponsor" => "https://github.com/sponsors/akoutmos"
}
]
end
defp aliases do
[
docs: [&massage_readme/1, "docs", ©_files/1],
test: ["test --exclude mix_task:true"]
]
end
defp copy_files(_) do
# Set up directory structure
File.mkdir_p!("./doc/guides/images")
# Copy over image files
"./guides/images/"
|> File.ls!()
|> Enum.each(fn image_file ->
File.cp!("./guides/images/#{image_file}", "./doc/guides/images/#{image_file}")
end)
# Clean up previous file massaging
File.rm!("./README.md")
File.rename!("./README.md.orig", "./README.md")
end
defp massage_readme(_) do
hex_docs_friendly_header_content = """
<br>
<img align="center" width="33%" src="guides/images/logo.svg" alt="PromEx Logo" style="margin-left:33%">
<img align="center" width="70%" src="guides/images/logo_text.png" alt="PromEx Logo" style="margin-left:15%">
<br>
<div align="center">Prometheus metrics and Grafana dashboards for all of your favorite Elixir libraries</div>
<br>
--------------------
[![Hex.pm](https://img.shields.io/hexpm/v/prom_ex?style=for-the-badge)](http://hex.pm/packages/prom_ex)
[![Build Status](https://img.shields.io/github/actions/workflow/status/akoutmos/prom_ex/main.yml?label=Build%20Status&style=for-the-badge&branch=master)](https://github.com/akoutmos/prom_ex/actions)
[![Coverage Status](https://img.shields.io/coveralls/github/akoutmos/prom_ex/master?style=for-the-badge)](https://coveralls.io/github/akoutmos/prom_ex?branch=master)
[![Elixir Slack Channel](https://img.shields.io/badge/slack-%23prom__ex-orange.svg?style=for-the-badge&logo=slack)](https://elixir-lang.slack.com/archives/C01NZ0FBFSR)
[![Support PromEx](https://img.shields.io/badge/Support%20PromEx-%E2%9D%A4-lightblue?style=for-the-badge)](https://github.com/sponsors/akoutmos)
"""
File.cp!("./README.md", "./README.md.orig")
readme_contents = File.read!("./README.md")
massaged_readme =
Regex.replace(
~r/<!--START-->(.|\n)*<!--END-->/,
readme_contents,
hex_docs_friendly_header_content
)
File.write!("./README.md", massaged_readme)
end
end