mix.exs (1941B)
1 defmodule DBConnection.Mixfile do 2 use Mix.Project 3 4 @source_url "https://github.com/elixir-ecto/db_connection" 5 @pools [:connection_pool, :ownership] 6 @version "2.4.2" 7 8 def project do 9 [ 10 app: :db_connection, 11 version: @version, 12 elixir: "~> 1.7", 13 deps: deps(), 14 docs: docs(), 15 description: description(), 16 package: package(), 17 build_per_environment: false, 18 consolidate_protocols: false, 19 test_paths: test_paths(Mix.env()), 20 aliases: ["test.all": ["test", "test.pools"], "test.pools": &test_pools/1], 21 preferred_cli_env: ["test.all": :test] 22 ] 23 end 24 25 def application do 26 [ 27 extra_applications: [:logger], 28 mod: {DBConnection.App, []} 29 ] 30 end 31 32 defp deps do 33 [ 34 {:connection, "~> 1.0"}, 35 {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, 36 {:telemetry, "~> 0.4 or ~> 1.0"} 37 ] 38 end 39 40 defp docs do 41 [ 42 source_url: @source_url, 43 source_ref: "v#{@version}", 44 main: DBConnection, 45 extras: ["CHANGELOG.md"] 46 ] 47 end 48 49 defp description do 50 """ 51 Database connection behaviour for database transactions and connection pooling 52 """ 53 end 54 55 defp package do 56 %{ 57 licenses: ["Apache-2.0"], 58 maintainers: ["James Fish"], 59 links: %{"GitHub" => @source_url} 60 } 61 end 62 63 defp test_paths(pool) when pool in @pools, do: ["integration_test/#{pool}"] 64 defp test_paths(_), do: ["test"] 65 66 defp test_pools(args) do 67 for env <- @pools, do: env_run(env, args) 68 end 69 70 defp env_run(env, args) do 71 args = if IO.ANSI.enabled?(), do: ["--color" | args], else: ["--no-color" | args] 72 73 IO.puts("==> Running tests for MIX_ENV=#{env} mix test") 74 75 {_, res} = 76 System.cmd("mix", ["test" | args], 77 into: IO.binstream(:stdio, :line), 78 env: [{"MIX_ENV", to_string(env)}] 79 ) 80 81 if res > 0 do 82 System.at_exit(fn _ -> exit({:shutdown, 1}) end) 83 end 84 end 85 end