Current section
Files
Jump to
Current section
Files
mix.exs
defmodule Mdqx.MixProject do
use Mix.Project
@version "0.0.1"
@url "https://githlab.com/lab421/mdqx"
@deps [
{:earmark_parser, "~> 1.4.31" },
{:excoveralls, "~> 0.16.0", only: [:test]},
{:extractly, "~> 0.5.3", only: [:dev]},
]
@description """
MDQX MarkDown Querier and eXtractor
It is inspired by tools like jq to allow filtering and extraction of
semantic elements from markdown documents.
It relies on EarmarkParser to get a semantic representation of the
Markdown document to be filtered.
"""
def project do
[
app: :mdqx,
version: @version,
elixir: "~> 1.14",
deps: @deps,
description: @description,
elixirc_paths: elixirc_paths(Mix.env()),
escript: escript_config(),
package: package(),
start_permanent: Mix.env() == :prod,
aliases: [docs: &build_docs/1]
]
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(:dev), do: ["lib"]
defp elixirc_paths(_), do: ["lib"]
defp escript_config do
[main_module: Mdqx.Cli]
end
defp package do
[
files: [
"lib",
"mix.exs",
"README.md",
"LICENSE"
],
maintainers: [
"Robert Dober <robert.dober@gmail.com>",
],
licenses: [
"Apache-2.0"
],
links: %{
"Gitlab" => "https://gitlab.com/lab421/mdqx"
}
]
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 = ["Mdqx", @version, Mix.Project.compile_path()]
opts = ~w[--main Mdqx --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