-
Notifications
You must be signed in to change notification settings - Fork 2
/
mix.exs
119 lines (108 loc) · 3.08 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
defmodule DateTimeParser.MixProject do
use Mix.Project
@version "1.2.0"
def project do
[
app: :date_time_parser,
name: "DateTimeParser",
version: @version,
homepage_url: "https://hexdocs.pm/date_time_parser",
source_url: "https://github.com/dbernheisel/date_time_parser",
elixir: ">= 1.12.0",
elixirc_paths: elixirc_paths(Mix.env()),
aliases: aliases(),
package: package(),
docs: docs(),
start_permanent: Mix.env() == :prod,
preferred_cli_env: [
tests: :test,
benchmark: :bench,
profile: :bench
],
deps: deps(),
description: "Parse a string into DateTime, NaiveDateTime, Time, or Date struct."
]
end
def application do
[
extra_applications: [:logger]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp package do
[
files: [
"lib",
"mix.exs",
"CODE_OF_CONDUCT*",
"CHANGELOG*",
"README*",
"LICENSE*",
"EXAMPLES*",
"priv/tzdata*/*"
],
maintainers: ["David Bernheisel"],
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/dbernheisel/date_time_parser",
"Readme" => "https://github.com/dbernheisel/date_time_parser/blob/#{@version}/README.md",
"Changelog" =>
"https://github.com/dbernheisel/date_time_parser/blob/#{@version}/CHANGELOG.md"
}
]
end
defp deps() do
[
{:exprof, "~> 0.2.0", only: :bench},
{:kday, "~> 1.0", runtime: false},
{:benchee, "~> 1.0", only: [:bench], runtime: false},
{:tz, "~> 0.24", only: [:dev, :test, :bench], runtime: false},
{:credo, "~> 1.1", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.20", only: :dev, runtime: false},
{:nimble_parsec, "~> 1.4", only: [:dev, :test], runtime: false}
]
end
defp docs() do
[
main: "DateTimeParser",
source_ref: @version,
extras: [
"pages/Future-UTC-DateTime.md",
"CHANGELOG.md",
"EXAMPLES.livemd",
"LICENSE.md"
]
]
end
defp tests() do
[]
|> add_if("compile --force --warnings-as-errors", !System.get_env("CI"))
|> add_if("compile.nimble", !System.get_env("CI"))
|> add_if("format --check-formatted", true)
|> add_if("credo --strict", true)
|> add_if("test", true)
end
defp aliases() do
[
"compile.nimble": [
"cmd rm -f lib/combinators.ex",
"nimble_parsec.compile lib/combinators.ex.exs",
"compile"
],
tests: tests(),
profile: ["run bench/profile.exs"],
benchmark: [
"run bench/self.exs",
"cmd ruby bench/ruby.rb",
"cmd ruby bench/rails.rb"
]
]
end
defp add_if(commands, command, true), do: commands ++ [command]
defp add_if(commands, _command, ""), do: commands
defp add_if(commands, command, version) when is_binary(version) do
add_if(commands, command, Version.match?(System.version(), version))
end
defp add_if(commands, _command, _), do: commands
end