mix.exs

defmodule FluxAMQP.MixProject do
  use Mix.Project

  def project do
    [
      app: :flux_amqp,
      name: "Flux AMQP",
      description: "AMQP Interface for message consumption and delivery.",
      source_url: "https://gitlab.com/uplug/open/elixir-modules/flux_amqp",
      version: "0.0.1",
      elixir: "~> 1.9",
      build_embedded: Mix.env() == :prod,
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps(),
      docs: docs(),
      package: package(),
      test_coverage: [tool: ExCoveralls],
      preferred_cli_env: preferred_cli_env(),
      test_coverage: [tool: ExCoveralls]
    ]
  end

  def application do
    [
      extra_applications: [:logger]
    ]
  end

  def docs do
    [
      main: "FluxAMQP",
      authors: ["Jonathan Moraes"],
      source_url_pattern:
        "https://gitlab.com/uplug/open/elixir-modules/flux_amqp/blob/master/app/%{path}#L%{line}"
    ]
  end

  defp package do
    [
      licenses: ["Apache-2.0"],
      links: %{
        "GitLab" => "https://gitlab.com/uplug/open/elixir-modules/flux_amqp"
      }
    ]
  end

  defp deps do
    [
      {:amqp, "~> 1.2.2"},
      {:credo, "~> 1.1.3", only: [:dev, :test], runtime: false},
      {:ex_doc, "~> 0.21.2", only: [:dev, :test], runtime: false},
      {:excoveralls, "~> 0.11.2", only: [:dev, :test]}
    ]
  end

  defp preferred_cli_env do
    [
      coveralls: :test,
      "coveralls.detail": :test,
      "coveralls.post": :test,
      "coveralls.html": :test,
      "test.coverage": :test,
      "test.static": :test
    ]
  end

  defp aliases do
    [
      "test.coverage": ["coveralls"],
      "test.static": ["credo list --strict --all"]
    ]
  end
end