johnhamelink
2/19/2016 - 3:54 PM

mix.exs

defmodule DB.Mixfile do
  use Mix.Project

  def project do
    [app: :db,
     version: "0.0.2",
     build_path: "../../_build",
     config_path: "../../config/config.exs",
     deps_path: "../../deps",
     lockfile: "../../mix.lock",
     elixir: "~> 1.2",
     elixirc_paths: elixirc_paths(Mix.env),
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     deps: deps]
  end

  def application do
    [
      applications: apps(Mix.env),
      mod: {DB, []}
    ]
  end

  def apps(:test) do
    apps(:all) ++ [:faker]
  end

  def apps(_all) do
    [
      :logger, :postgrex, :ecto, :joken,
      :geo, :poison
    ]
  end

  defp deps do
    [
      {:postgrex, "~> 0.11.0"},
      {:ecto, "~> 1.1.2", override: true},
      {:geo, "~> 1.0"},                    # PostGIS support for Ecto
      {:joken, "~> 1.0"},                  # For JWT (user signing)
      {:poison, "~> 1.5"},                 # JSON library
      {:faker, github: "igas/faker",       # Generate random text to use
        branch: "master", only: :test},    # in tests
    ]
  end

  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

end