Current section
Files
Jump to
Current section
Files
mix.exs
defmodule Modkit.MixProject do
use Mix.Project
def project do
[
app: :modkit,
version: "0.10.0",
description: "A set of tool to work with Elixir modules files.",
elixir: "~> 1.13",
consolidate_protocols: Mix.env() != :test,
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
package: package(),
modkit: modkit(),
dialyzer: dialyzer(),
versioning: versioning(),
source_url: "https://github.com/lud/modkit"
]
end
defp elixirc_paths(:prod) do
["lib"]
end
defp elixirc_paths(_) do
["lib", "test/support"]
end
def application do
[
extra_applications: [:logger]
]
end
defp deps do
[
{:cli_mate, "~> 0.10", runtime: false, only: [:dev, :test]},
{:libdev, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:readmix, ">= 0.0.0", only: [:dev, :test], runtime: false}
]
end
defp docs do
[
filter_modules: fn mod, _ -> "Sample" not in Module.split(mod) end
]
end
defp package do
[
licenses: ["MIT"],
files: ~w(lib mix.exs README* LICENSE* CHANGELOG*),
links: %{
"Github" => "https://github.com/lud/modkit"
}
]
end
defp modkit do
[
mount: [
{Modkit, "lib/modkit"},
{Modkit.Support, "test/support"},
{Mix.Tasks, "lib/mix/tasks", flavor: :mix_task},
{Samples, :ignore}
]
]
end
defp versioning do
[
before_commit: [
&readmix/1,
{:add, "README.md"},
&gen_changelog/2,
{:add, "CHANGELOG.md"}
]
]
end
def readmix(vsn) do
rdmx = Readmix.new(vars: %{app_vsn: vsn})
:ok = Readmix.update_file(rdmx, "README.md")
end
defp gen_changelog(vsn, info) do
args = ["cliff", "--tag", vsn, "--with-tag-message", info.annotation, "-o", "CHANGELOG.md"]
case System.cmd("git", args, stderr_to_stdout: true) do
{_, 0} -> IO.puts("Updated CHANGELOG.md with #{vsn}")
{out, _} -> {:error, "Could not update CHANGELOG.md:\n\n #{out}"}
end
end
defp dialyzer do
[
flags: [:unmatched_returns, :error_handling, :unknown, :extra_return],
list_unused_filters: true,
plt_add_apps: [:mix, :eex],
plt_local_path: "_build/plts"
]
end
def cli do
[
preferred_envs: [dialyzer: :test]
]
end
end