forked from pragdave/earmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
111 lines (94 loc) · 2.91 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
defmodule Earmark.Mixfile do
use Mix.Project
@version "1.4.48"
@url "https://github.com/pragdave/earmark"
@deps [
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},
{:benchfella, "~> 0.3.0", only: [:dev]},
{:earmark_ast_dsl, "~> 0.3.6", only: [:dev, :test]},
{:excoveralls, "~> 0.16.0", only: [:test]},
# {:extractly, "~> 0.5.0", git: "https://github.com/RobertDober/extractly.git", tag: "v0.5.0-pre1", only: [:dev]},
{:extractly, "~> 0.5.3", only: [:dev]},
{:floki, "~> 0.21", only: [:dev, :test]},
{:traverse, "~> 1.0.1", only: [:dev, :test]}
]
@description """
Earmark is a pure-Elixir Markdown converter.
It is intended to be used as a library (just call Earmark.as_html),
but can also be used as a command-line tool (run mix escript.build
first).
Output generation is pluggable.
"""
############################################################
def project do
[
app: :earmark,
version: @version,
compilers: [:leex, :yecc] ++ Mix.compilers(),
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
escript: escript_config(),
deps: @deps,
description: @description,
package: package(),
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test
],
test_coverage: [tool: ExCoveralls],
aliases: [docs: &build_docs/1]
]
end
def application do
[
extra_applications: [:eex]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support", "dev"]
defp elixirc_paths(:dev), do: ["lib", "lib1", "bench", "dev"]
defp elixirc_paths(_), do: ["lib", "lib1"]
defp escript_config do
[main_module: Earmark.Cli]
end
defp package do
[
files: [
"lib",
"lib1",
"src/*.xrl",
"src/*.yrl",
"mix.exs",
"README.md"
],
maintainers: [
"Robert Dober <robert.dober@gmail.com>",
"Dave Thomas <dave@pragdave.me>"
],
licenses: [
"Apache-2.0"
],
links: %{
"GitHub" => "https://github.com/pragdave/earmark"
}
]
end
@prerequisites """
run `mix escript.install hex ex_doc` and adjust `PATH` accordingly
"""
defp build_docs(_) do
Mix.Task.run("compile")
ex_doc = Path.join(Mix.path_for(:escripts), "ex_doc")
Mix.shell().info("Using escript: #{ex_doc} to build the docs")
unless File.exists?(ex_doc) do
raise "cannot build docs because escript for ex_doc is not installed, make sure to \n#{@prerequisites}"
end
args = ["Earmark", @version, Mix.Project.compile_path()]
opts = ~w[--main Earmark --source-ref v#{@version} --source-url #{@url}]
Mix.shell().info("Running: #{ex_doc} #{inspect(args ++ opts)}")
System.cmd(ex_doc, args ++ opts)
Mix.shell().info("Docs built successfully")
end
end
# SPDX-License-Identifier: Apache-2.0