-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmix.exs
More file actions
149 lines (136 loc) · 4.16 KB
/
Copy pathmix.exs
File metadata and controls
149 lines (136 loc) · 4.16 KB
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
defmodule Localize.Translate.MixProject do
use Mix.Project
@name "Localize Translate"
@version "0.2.0"
@source_url "https://github.com/elixir-localize/localize_translate"
def project do
[
app: :localize_translate,
name: @name,
source_url: @source_url,
homepage_url: "https://hex.pm/packages/localize_translate",
version: @version,
elixir: "~> 1.17",
description: "Embedded translations for Ecto schemas",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
aliases: aliases(),
elixirc_paths: elixirc_paths(Mix.env()),
test_coverage: [
# `test/support` is compiled into the test build, so its fixture
# schemas, factory and repo are counted as covered code. They are
# test scaffolding, not library surface — exclude them and the
# submodules the `use Localize.Translate` macro generates for them.
ignore_modules: [
# A hand-invoked code generator: `run/1` writes a migration file into
# the host project, so exercising it in the suite would mean
# generating and cleaning up files on every run. Its pure helpers are
# tested directly in gen_function_migration_test.exs.
Mix.Tasks.Localize.Translate.Gen.TranslateFunction,
Localize.Translate.Factory,
Localize.Translate.Repo,
Localize.Translate.TestCase,
~r/^Localize\.Translate\.(Article|Book|Brochure|Comment|Leaflet|Magazine|Page|PageTranslation|Pamphlet)(\.|$)/
]
],
app_list: app_list(Mix.env()),
package: package(),
deps: deps(),
docs: docs(),
dialyzer: [
plt_add_apps: ~w(ecto ecto_sql inets localize mix)a,
flags: [
:error_handling,
:unknown,
:underspecs,
:extra_return,
:missing_return
]
]
]
end
defp docs do
[
source_ref: "v#{@version}",
main: "readme",
formatters: ["html", "markdown"],
extras: [
"README.md",
"guides/translatable_database_systems.md": [
title: "Building Translatable Database Systems"
],
"LICENSE.md": [title: "License"],
"CHANGELOG.md": [title: "Changelog"]
],
groups_for_extras: [
Guides: ~r"guides/.*"
]
]
end
def application do
[extra_applications: [:logger]]
end
defp deps do
[
{:ecto, "~> 3.0"},
{:localize, "~> 1.0"},
# Optional dependencies
{:ecto_sql, "~> 3.0", optional: true},
{:postgrex, "~> 0.19 or ~> 1.0", optional: true},
# Doc dependencies
{:ex_doc, ">= 0.0.0", only: [:dev, :release], runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false, optional: true}
] ++ maybe_json_polyfill()
end
defp maybe_json_polyfill do
if Code.ensure_loaded?(:json) do
[]
else
[{:json_polyfill, "~> 0.2 or ~> 1.0"}]
end
end
defp package do
[
licenses: ["Apache-2.0"],
maintainers: ["Kip Cole"],
links: links(),
files: [
"lib",
"guides",
"mix.exs",
"README.md",
"LICENSE.md",
"CHANGELOG.md"
]
]
end
def links do
%{
"GitHub" => "https://github.com/elixir-localize/localize_translate",
"Readme" =>
"https://github.com/elixir-localize/localize_translate/blob/v#{@version}/README.md",
"Changelog" =>
"https://github.com/elixir-localize/localize_translate/blob/v#{@version}/CHANGELOG.md"
}
end
# Include Ecto and Postgrex applications in tests
def app_list(:test), do: [:ecto, :postgrex]
def app_list(_), do: app_list()
def app_list, do: []
# Always compile files in "lib". In tests compile also files in
# "test/support"
def elixirc_paths(:test), do: elixirc_paths() ++ ["mix", "test/support"]
def elixirc_paths(:dev), do: elixirc_paths() ++ ["mix"]
def elixirc_paths(_), do: elixirc_paths()
def elixirc_paths, do: ["lib"]
defp aliases do
[
test: [
"ecto.create --quiet",
"ecto.migrate --quiet",
"test"
]
]
end
end