defmodule FakeRiak.MixProject do use Mix.Project @source_url "https://github.com/bsanyi/fake_riak" def project do [ app: :fake_riak, version: "0.2.2", elixir: "~> 1.19", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), escript: escript(), # The CLI is an argv-parsing / process-blocking entry point that is # awkward to exercise under coverage; leave it out of the threshold. test_coverage: [summary: [threshold: 90], ignore_modules: [FakeRiak.CLI]], description: description(), package: package(), source_url: @source_url, deps: deps(), aliases: aliases() ] end defp description do "In-memory fake for Riak, etcd, Redis and memcached that speaks their wire " <> "protocols on TCP, so you can point real clients at it. Ships as an escript." end # Metadata for `mix hex.publish` (and thus `mix escript.install hex fake_riak`). defp package do [ licenses: ["MIT"], links: %{"GitHub" => @source_url}, # Everything needed to build the escript on the installing machine. files: ~w(lib config mix.exs README.md LICENSE .formatter.exs) ] end # Compile the test-only support modules (e.g. the TCP client) only under # `MIX_ENV=test`, so they never end up in the application build. defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] # Run "mix help compile.app" to learn about applications. def application do [ extra_applications: [:logger, :crypto, :public_key, :ssl], mod: {FakeRiak.Application, []} ] end # Build a single self-contained script with `mix escript.build`. defp escript do # `app: nil` stops the escript from auto-starting `:fake_riak` (which would # boot every endpoint from the baked-in config). `FakeRiak.CLI` starts the # app itself, only after it has applied the endpoints chosen on the CLI. [main_module: FakeRiak.CLI, app: nil] end # Run "mix help deps" to learn about dependencies. defp deps do [ {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, {:credo, "~> 1.7", only: :dev, runtime: false}, {:dialyxir, "~> 1.4", only: :dev, runtime: false}, {:mix_audit, "~> 2.1", only: :dev, runtime: false} ] end defp aliases do [ precommit: [ "cmd echo \n==== mix format ===", "format", "cmd echo \n==== mix compile --warnings-as-errors ===", "compile --warnings-as-errors", "cmd echo \n==== mix credo --strict ===", "credo --strict", "cmd echo \n==== mix test --warnings-as-errors --cover ===", "cmd mix test --warnings-as-errors --cover", "cmd echo \n==== mix escript.build ===", "escript.build", "cmd echo \n==== mix dialyzer ===", "dialyzer", "cmd echo \n==== mix docs ===", "docs", "cmd echo \n==== mix deps.unlock --check-unused ===", "deps.unlock --check-unused", "cmd echo \n==== mix deps.audit ===", "cmd mix deps.audit", "cmd echo \n==== mix hex.audit ===", "cmd mix hex.audit", "cmd echo \n==== mix hex.outdated ===", "cmd mix hex.outdated", "cmd echo \n==== mix hex.build ===", "cmd mix hex.build" ] ] end end