defmodule GenLoop.Mixfile do use Mix.Project def project do [ app: :gen_loop, description: """ A supervised free-form loop function. Elixir adapter for plain_fsm, with receive / sync-call macros and GenServer-like starting, stopping and name registration. """, version: "2.1.0", elixir: "~> 1.4", build_embedded: Mix.env() == :prod, deps: deps(), name: "GenLoop", source_url: "https://github.com/lud/gen_loop", package: package(), dialyzer: dialyzer(), versioning: versioning() ] end # Configuration for the OTP application # # Type "mix help compile.app" for more information def application do # Specify extra applications you'll use from Erlang/Elixir [extra_applications: [:logger]] end defp deps do [ {:plain_fsm, "~> 1.4"}, # Dev {:libdev, ">= 0.0.0", only: [:dev, :test], runtime: false}, {:readmix, "~> 0.6", only: [:dev, :test], runtime: false} ] end defp package() do [ licenses: ["MIT"], maintainers: ["Ludovic Demblans "], links: %{"Github" => "https://github.com/lud/gen_loop"} ] end defp dialyzer do [ flags: [:unmatched_returns, :error_handling, :unknown, :extra_return], list_unused_filters: true, plt_add_deps: :app_tree, plt_add_apps: [:ex_unit, :mix], plt_local_path: "_build/plts" ] end def cli do [ preferred_envs: [ dialyzer: :test ] ] end defp versioning do [ annotate: true, before_commit: [ &readmix/1, {:add, "README.md"}, &gen_changelog/1, {:add, "CHANGELOG.md"} ] ] end def readmix(vsn) do rdmx = Readmix.new(vars: %{app_vsn: vsn}) :ok = Readmix.update_file(rdmx, "README.md") end defp gen_changelog(vsn) do case System.cmd("git", ["cliff", "--tag", vsn, "-o", "CHANGELOG.md"], stderr_to_stdout: true) do {_, 0} -> IO.puts("Updated CHANGELOG.md with #{vsn}") {out, _} -> {:error, "Could not update CHANGELOG.md:\n\n #{out}"} end end end