   @version String.trim(File.read!("VERSION"))
 
   def project do
-    [app: :bs,
-     version: @version,
-     elixir: "~> 1.5",
-     elixirc_paths: elixirc_paths(Mix.env),
-     compilers: [:phoenix, :gettext] ++ Mix.compilers,
-     build_embedded: Mix.env == :prod,
-     start_permanent: Mix.env == :prod,
-     preferred_cli_env: preferred_cli_env(),
-     test_coverage: [tool: ExCoveralls],
-     erlc_options: erlc_options(Mix.env),
-     dialyzer: dialyzer(),
-     aliases: aliases(),
-     deps: deps()]
+    [
+      app: :bs,
+      version: @version,
+      elixir: "~> 1.5",
+      elixirc_paths: elixirc_paths(Mix.env()),
+      compilers: [:phoenix, :gettext] ++ Mix.compilers(),
+      build_embedded: Mix.env() == :prod,
+      start_permanent: Mix.env() == :prod,
+      preferred_cli_env: preferred_cli_env(),
+      test_coverage: [tool: ExCoveralls],
+      erlc_options: erlc_options(Mix.env()),
+      dialyzer: dialyzer(),
+      aliases: aliases(),
+      deps: deps()
+    ]
   end
 
   # Configuration for the OTP application.

  end

  def extra_applications(:dev) do
    [:mix| extra_applications(:all)]
  end

  def extra_applications(_all) do

      {:poison, "~> 3.0"},
      {:postgrex, ">= 0.0.0"},
      {:proper, github: "manopapad/proper", tag: "v1.2", only: :test},
      {:reprise, "~> 0.5.0", only: :dev}
    ]
  end

  defp dialyzer do
    [plt_add_deps: :transitive, plt_add_apps: [:mnesia]]
  end

  defp aliases do
    exclusions =
      [
        "lib/bs.ex",
        "lib/bs_web.ex",
        "lib/bs_web/gettext.ex",
        "lib/bs_web/router.ex",
        "lib/bs_web/views/error_helpers.ex",
      ]
      |> Enum.map(&("--exclude " <> &1))
      |> Enum.join(" ")

    [
      "bs.watch": &watch/1,
      "bs.xref": [
        "xref graph --format dot #{exclusions}",
        &xref/1
      ]
    ]
  end

  def test _ do
    Mix.shell().cmd("MIX_ENV=test mix test")
  end

  def xref(_) do
    Mix.shell().cmd("dot xref_graph.dot -Tsvg -o xref_graph.svg")
  end

  def watch(_) do
    Mix.shell().cmd(
      "watchman-make -p 'lib/**/*.ex' 'test/**/*.ex' 'test/**/*.exs' --run 'mix test --stale'"
    )
  end
end
