ash_double_entry/mix.exs

207 lines
5.4 KiB
Elixir
Raw Normal View History

2023-07-22 12:27:52 +12:00
defmodule AshDoubleEntry.MixProject do
use Mix.Project
2023-12-23 15:20:43 +13:00
@version "0.2.3"
2023-08-19 15:57:12 +12:00
@description """
A customizable double entry bookkeeping system backed by Ash resources.
"""
2023-07-22 12:27:52 +12:00
def project do
[
app: :ash_double_entry,
version: @version,
2023-07-22 12:27:52 +12:00
elixir: "~> 1.15",
start_permanent: Mix.env() == :prod,
consolidate_protocols: Mix.env() != :test,
2023-08-19 15:57:12 +12:00
description: @description,
2023-08-06 16:45:07 +12:00
aliases: aliases(),
2023-08-19 15:57:12 +12:00
deps: deps(),
package: package(),
docs: docs(),
source_url: "https://github.com/ash-project/ash_double_entry",
homepage_url: "https://github.com/ash-project/ash_double_entry",
consolidate_protocols: Mix.env() != :test
2023-07-22 12:27:52 +12:00
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
2023-08-19 15:57:12 +12:00
defp package do
[
name: :ash_double_entry,
licenses: ["MIT"],
files: ~w(lib .formatter.exs mix.exs README* LICENSE*
CHANGELOG* documentation),
links: %{
GitHub: "https://github.com/ash-project/ash_double_entry"
}
]
end
2023-08-06 16:45:07 +12:00
defp aliases do
[
sobelow: "sobelow --skip",
credo: "credo --strict",
2023-09-27 02:46:07 +13:00
docs: [
"spark.cheat_sheets",
"docs",
"spark.replace_doc_links",
2023-09-27 02:46:07 +13:00
"spark.cheat_sheets_in_search"
],
2023-08-06 16:45:07 +12:00
"spark.formatter":
2023-09-27 02:46:07 +13:00
"spark.formatter --extensions AshDoubleEntry.Account,AshDoubleEntry.Balance,AshDoubleEntry.Transfer",
"spark.cheat_sheets":
"spark.cheat_sheets --extensions AshDoubleEntry.Account,AshDoubleEntry.Balance,AshDoubleEntry.Transfer",
"spark.cheat_sheets_in_search":
"spark.cheat_sheets_in_search --extensions AshDoubleEntry.Account,AshDoubleEntry.Balance,AshDoubleEntry.Transfer"
2023-08-06 16:45:07 +12:00
]
end
2023-08-19 15:57:12 +12:00
defp extras() do
2023-09-27 02:46:07 +13:00
"documentation/**/*.{md,livemd,cheatmd}"
2023-08-19 15:57:12 +12:00
|> Path.wildcard()
|> Enum.map(fn path ->
title =
path
|> Path.basename(".md")
2023-09-27 02:46:07 +13:00
|> Path.basename(".cheatmd")
|> Path.basename(".livemd")
2023-08-19 15:57:12 +12:00
|> String.split(~r/[-_]/)
2023-09-27 02:46:07 +13:00
|> Enum.map_join(" ", &capitalize/1)
2023-08-19 15:57:12 +12:00
|> case do
"F A Q" ->
"FAQ"
other ->
other
end
{String.to_atom(path),
[
title: title
]}
end)
end
2023-09-27 02:46:07 +13:00
defp capitalize(string) do
string
|> String.split(" ")
|> Enum.map(fn string ->
[hd | tail] = String.graphemes(string)
String.capitalize(hd) <> Enum.join(tail)
2023-08-19 15:57:12 +12:00
end)
end
2023-09-27 02:46:07 +13:00
defp groups_for_extras() do
[
Tutorials: ~r'documentation/tutorials',
"How To": ~r'documentation/how_to',
Topics: ~r'documentation/topics',
DSLs: ~r'documentation/dsls'
]
end
2023-08-19 15:57:12 +12:00
defp docs do
[
main: "get-started-with-double-entry",
source_ref: "v#{@version}",
logo: "logos/small-logo.png",
extras: extras(),
2023-10-03 02:28:11 +13:00
before_closing_head_tag: fn type ->
if type == :html do
"""
<script>
if (location.hostname === "hexdocs.pm") {
var script = document.createElement("script");
script.src = "https://plausible.io/js/script.js";
script.setAttribute("defer", "defer")
script.setAttribute("data-domain", "ashhexdocs")
document.head.appendChild(script);
}
</script>
2023-10-03 02:28:11 +13:00
"""
end
end,
2023-08-19 15:57:12 +12:00
spark: [
extensions: [
%{
module: AshDoubleEntry.Balance,
name: "AshDoubleEntry.Balance",
target: "Ash.Resource",
type: "Extension"
},
%{
module: AshDoubleEntry.Transfer,
name: "AshDoubleEntry.Transfer",
target: "Ash.Resource",
type: "Extension"
},
%{
2023-08-20 07:07:03 +12:00
module: AshDoubleEntry.Account,
name: "AshDoubleEntry.Account",
2023-08-19 15:57:12 +12:00
target: "Ash.Resource",
type: "Extension"
}
]
],
groups_for_extras: groups_for_extras(),
groups_for_modules: [
2023-09-27 02:46:07 +13:00
Introspection: [
AshDoubleEntry.Account.Info,
AshDoubleEntry.Balance.Info,
AshDoubleEntry.Transfer.Info
],
Entities: [
AshDoubleEntry.Account,
AshDoubleEntry.Balance,
AshDoubleEntry.Transfer
],
Types: [
AshDoubleEntry.ULID
],
AshDoubleEntry: ~r/AshDoubleEntry.*/
2023-08-19 15:57:12 +12:00
]
]
end
2023-07-22 12:27:52 +12:00
# Run "mix help deps" to learn about dependencies.
defp deps do
[
2023-12-23 15:19:49 +13:00
{:ash, ash_version("~> 2.17 and >= 2.17.17")},
2023-12-06 13:49:23 +13:00
{:ash_money, "~> 0.1.3"},
{:ex_money_sql, "~> 1.10"},
2023-08-19 16:17:07 +12:00
{:git_ops, "~> 2.5", only: [:dev, :test]},
{:ex_doc, github: "elixir-lang/ex_doc", only: [:dev, :test], runtime: false},
2023-08-19 16:17:07 +12:00
{:ex_check, "~> 0.14", only: [:dev, :test]},
{:credo, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:dialyxir, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:sobelow, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:excoveralls, "~> 0.14", only: [:dev, :test]}
2023-07-22 12:27:52 +12:00
]
end
2023-08-19 16:17:07 +12:00
defp ash_version(default_version) do
case System.get_env("ASH_VERSION") do
nil ->
default_version
"local" ->
2023-12-06 17:12:32 +13:00
[path: "../ash", override: true]
2023-08-19 16:17:07 +12:00
"main" ->
2023-12-06 17:12:32 +13:00
[git: "https://github.com/ash-project/ash.git", override: true]
2023-08-19 16:17:07 +12:00
version when is_binary(version) ->
"~> #{version}"
version ->
version
end
end
2023-07-22 12:27:52 +12:00
end