2019-12-05 03:58:20 +13:00
|
|
|
defmodule AshPostgres.MixProject do
|
2019-10-07 09:36:18 +13:00
|
|
|
use Mix.Project
|
|
|
|
|
2019-12-05 04:13:24 +13:00
|
|
|
@description """
|
|
|
|
A postgres data layer for `Ash` resources. Leverages Ecto's postgres
|
|
|
|
support, and delegates to a configured repo.
|
|
|
|
"""
|
|
|
|
|
2023-02-17 09:24:20 +13:00
|
|
|
@version "1.3.11"
|
2020-06-01 17:36:43 +12:00
|
|
|
|
2019-10-07 09:36:18 +13:00
|
|
|
def project do
|
|
|
|
[
|
2019-12-05 03:58:20 +13:00
|
|
|
app: :ash_postgres,
|
2020-06-01 17:36:43 +12:00
|
|
|
version: @version,
|
2021-01-23 10:44:46 +13:00
|
|
|
elixir: "~> 1.11",
|
2019-10-07 09:36:18 +13:00
|
|
|
start_permanent: Mix.env() == :prod,
|
2019-12-05 04:13:24 +13:00
|
|
|
deps: deps(),
|
|
|
|
description: @description,
|
2020-06-03 14:47:41 +12:00
|
|
|
test_coverage: [tool: ExCoveralls],
|
2020-09-03 20:18:11 +12:00
|
|
|
elixirc_paths: elixirc_paths(Mix.env()),
|
2020-06-03 14:47:41 +12:00
|
|
|
preferred_cli_env: [
|
|
|
|
coveralls: :test,
|
2021-02-25 07:59:49 +13:00
|
|
|
"coveralls.github": :test,
|
|
|
|
"test.create": :test,
|
|
|
|
"test.migrate": :test,
|
|
|
|
"test.migrate_tenants": :test,
|
2022-05-19 05:21:58 +12:00
|
|
|
"test.check_migrations": :test,
|
2021-02-25 07:59:49 +13:00
|
|
|
"test.drop": :test,
|
|
|
|
"test.generate_migrations": :test,
|
|
|
|
"test.reset": :test
|
2020-06-03 14:47:41 +12:00
|
|
|
],
|
2020-06-03 15:29:11 +12:00
|
|
|
dialyzer: [
|
2020-09-11 12:26:47 +12:00
|
|
|
plt_add_apps: [:ecto, :ash, :mix]
|
2020-06-03 15:29:11 +12:00
|
|
|
],
|
2020-06-14 19:04:18 +12:00
|
|
|
docs: docs(),
|
2020-06-03 14:47:41 +12:00
|
|
|
aliases: aliases(),
|
2019-12-05 04:13:24 +13:00
|
|
|
package: package(),
|
|
|
|
source_url: "https://github.com/ash-project/ash_postgres",
|
2021-09-26 13:02:00 +13:00
|
|
|
homepage_url: "https://github.com/ash-project/ash_postgres",
|
|
|
|
consolidate_protocols: Mix.env() != :test
|
2019-12-05 04:13:24 +13:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2021-01-27 14:21:53 +13:00
|
|
|
if Mix.env() == :test do
|
|
|
|
def application() do
|
|
|
|
[applications: [:ecto, :ecto_sql, :jason, :ash, :postgrex], mod: {AshPostgres.TestApp, []}]
|
|
|
|
end
|
2021-01-27 14:02:53 +13:00
|
|
|
end
|
|
|
|
|
2020-09-03 20:18:11 +12:00
|
|
|
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
|
|
|
defp elixirc_paths(_), do: ["lib"]
|
|
|
|
|
2019-12-05 04:13:24 +13:00
|
|
|
defp package do
|
|
|
|
[
|
|
|
|
name: :ash_postgres,
|
|
|
|
licenses: ["MIT"],
|
2022-08-23 14:46:20 +12:00
|
|
|
files: ~w(lib .formatter.exs mix.exs README* LICENSE*
|
|
|
|
CHANGELOG* documentation),
|
2019-12-05 04:13:24 +13:00
|
|
|
links: %{
|
|
|
|
GitHub: "https://github.com/ash-project/ash_postgres"
|
|
|
|
}
|
2019-10-07 09:36:18 +13:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2022-08-19 06:56:36 +12:00
|
|
|
defp extras() do
|
2022-08-24 11:56:46 +12:00
|
|
|
"documentation/**/*.md"
|
2022-08-19 06:56:36 +12:00
|
|
|
|> Path.wildcard()
|
|
|
|
|> Enum.map(fn path ->
|
|
|
|
title =
|
|
|
|
path
|
|
|
|
|> Path.basename(".md")
|
|
|
|
|> String.split(~r/[-_]/)
|
|
|
|
|> Enum.map(&String.capitalize/1)
|
|
|
|
|> Enum.join(" ")
|
|
|
|
|> case do
|
|
|
|
"F A Q" ->
|
|
|
|
"FAQ"
|
|
|
|
|
|
|
|
other ->
|
|
|
|
other
|
|
|
|
end
|
|
|
|
|
|
|
|
{String.to_atom(path),
|
|
|
|
[
|
|
|
|
title: title
|
|
|
|
]}
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
defp groups_for_extras() do
|
2022-08-24 11:56:46 +12:00
|
|
|
"documentation/*"
|
2022-08-19 06:56:36 +12:00
|
|
|
|> Path.wildcard()
|
|
|
|
|> Enum.map(fn folder ->
|
|
|
|
name =
|
|
|
|
folder
|
|
|
|
|> Path.basename()
|
|
|
|
|> String.split(~r/[-_]/)
|
|
|
|
|> Enum.map(&String.capitalize/1)
|
|
|
|
|> Enum.join(" ")
|
|
|
|
|
|
|
|
{name, folder |> Path.join("**") |> Path.wildcard()}
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
2020-06-14 19:04:18 +12:00
|
|
|
defp docs do
|
|
|
|
[
|
2022-08-24 11:56:46 +12:00
|
|
|
main: "get-started-with-postgres",
|
2020-06-14 19:04:18 +12:00
|
|
|
source_ref: "v#{@version}",
|
|
|
|
logo: "logos/small-logo.png",
|
2022-08-19 06:56:36 +12:00
|
|
|
extras: extras(),
|
2023-01-18 19:00:23 +13:00
|
|
|
spark: [
|
|
|
|
mix_tasks: [
|
|
|
|
Postgres: [
|
|
|
|
Mix.Tasks.AshPostgres.GenerateMigrations,
|
|
|
|
Mix.Tasks.AshPostgres.Create,
|
|
|
|
Mix.Tasks.AshPostgres.Drop,
|
|
|
|
Mix.Tasks.AshPostgres.Migrate,
|
|
|
|
Mix.Tasks.AshPostgres.Rollback
|
|
|
|
]
|
|
|
|
],
|
|
|
|
extensions: [
|
|
|
|
%{
|
|
|
|
module: AshPostgres.DataLayer,
|
|
|
|
name: "AshPostgres",
|
|
|
|
target: "Ash.Resource",
|
|
|
|
type: "DataLayer"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
],
|
2022-08-19 06:56:36 +12:00
|
|
|
groups_for_extras: groups_for_extras(),
|
2020-06-14 19:04:18 +12:00
|
|
|
groups_for_modules: [
|
2022-08-24 11:56:46 +12:00
|
|
|
AshPostgres: [
|
2023-02-09 16:56:00 +13:00
|
|
|
AshPostgres,
|
2022-08-24 11:56:46 +12:00
|
|
|
AshPostgres.Repo,
|
|
|
|
AshPostgres.DataLayer
|
|
|
|
],
|
|
|
|
Introspection: [
|
|
|
|
AshPostgres.DataLayer.Info
|
|
|
|
],
|
|
|
|
"Postgres Expressions": [
|
|
|
|
AshPostgres.Functions.Fragment,
|
2022-10-11 05:06:54 +13:00
|
|
|
AshPostgres.Functions.TrigramSimilarity
|
2022-08-24 11:56:46 +12:00
|
|
|
],
|
2022-12-08 14:32:38 +13:00
|
|
|
"Custom Aggregates": [
|
|
|
|
AshPostgres.CustomAggregate
|
|
|
|
],
|
2022-08-24 11:56:46 +12:00
|
|
|
"Postgres Migrations": [
|
|
|
|
AshPostgres.Migration,
|
|
|
|
EctoMigrationDefault
|
|
|
|
],
|
2023-01-18 19:00:23 +13:00
|
|
|
Transformers: ~r/AshPostgres\.Transformers\..*/,
|
|
|
|
Internals: ~r/.*/
|
2020-06-14 19:04:18 +12:00
|
|
|
]
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2019-10-07 09:36:18 +13:00
|
|
|
# Run "mix help deps" to learn about dependencies.
|
|
|
|
defp deps do
|
|
|
|
[
|
2022-10-08 08:50:20 +13:00
|
|
|
{:ecto_sql, "~> 3.9"},
|
|
|
|
{:ecto, "~> 3.9"},
|
2020-10-01 13:57:22 +13:00
|
|
|
{:jason, "~> 1.0"},
|
2019-10-07 09:36:18 +13:00
|
|
|
{:postgrex, ">= 0.0.0"},
|
2023-02-13 13:09:25 +13:00
|
|
|
{:ash, ash_version("~> 2.6 and >= 2.6.3")},
|
2023-02-01 16:35:12 +13:00
|
|
|
{:git_ops, "~> 2.5", only: [:dev, :test]},
|
2022-12-11 09:59:50 +13:00
|
|
|
{:nimble_options, "~> 0.5"},
|
2023-02-01 16:35:12 +13:00
|
|
|
{:ex_doc, "~> 0.22", only: [:dev, :test], runtime: false},
|
|
|
|
{: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},
|
2022-04-29 02:50:00 +12:00
|
|
|
{:excoveralls, "~> 0.14", only: [:dev, :test]}
|
2020-06-03 14:47:41 +12:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2020-08-22 04:35:05 +12:00
|
|
|
defp ash_version(default_version) do
|
|
|
|
case System.get_env("ASH_VERSION") do
|
2023-02-11 09:41:41 +13:00
|
|
|
nil ->
|
|
|
|
default_version
|
|
|
|
|
|
|
|
"local" ->
|
|
|
|
[path: "../ash"]
|
|
|
|
|
|
|
|
"main" ->
|
|
|
|
[git: "https://github.com/ash-project/ash.git"]
|
|
|
|
|
|
|
|
version when is_binary(version) ->
|
|
|
|
"~> #{version}"
|
|
|
|
|
|
|
|
version ->
|
|
|
|
version
|
2020-08-22 04:35:05 +12:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-03 14:47:41 +12:00
|
|
|
defp aliases do
|
|
|
|
[
|
2020-09-11 12:26:47 +12:00
|
|
|
sobelow:
|
|
|
|
"sobelow --skip -i Config.Secrets --ignore-files lib/migration_generator/migration_generator.ex",
|
2020-06-15 19:05:21 +12:00
|
|
|
credo: "credo --strict",
|
2022-11-04 06:02:31 +13:00
|
|
|
docs: ["docs", "ash.replace_doc_links"],
|
2022-09-09 05:28:58 +12:00
|
|
|
"spark.formatter": "spark.formatter --extensions AshPostgres.DataLayer",
|
2021-02-25 07:59:49 +13:00
|
|
|
"test.generate_migrations": "ash_postgres.generate_migrations",
|
2022-05-19 05:21:58 +12:00
|
|
|
"test.check_migrations": "ash_postgres.generate_migrations --check",
|
2021-02-25 07:59:49 +13:00
|
|
|
"test.migrate_tenants": "ash_postgres.migrate --tenants",
|
|
|
|
"test.migrate": "ash_postgres.migrate",
|
|
|
|
"test.create": "ash_postgres.create",
|
2021-11-14 07:56:14 +13:00
|
|
|
"test.reset": ["test.drop", "test.create", "test.migrate", "ash_postgres.migrate --tenants"],
|
2021-02-25 07:59:49 +13:00
|
|
|
"test.drop": "ash_postgres.drop"
|
2019-10-07 09:36:18 +13:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|