docco icon indicating copy to clipboard operation
docco copied to clipboard

Elixir

Open wdiechmann opened this issue 7 years ago • 1 comments

May I suggest .ex and .exs providing support for Elixir?

# ./lib/taskrr/repo.ex
defmodule Taskrr.Repo do
  use Ecto.Repo, otp_app: :taskrr

  @doc """
  Dynamically loads the repository url from the
  DATABASE_URL environment variable.
  """
  def init(_, opts) do
    {:ok, Keyword.put(opts, :url, System.get_env("DATABASE_URL"))}
  end
end

# ./mix.exs
defmodule Taskrr.Mixfile do
  use Mix.Project

  def project do
    [app: :taskrr,
     version: "0.0.1",
     elixir: "~> 1.4",
     elixirc_paths: elixirc_paths(Mix.env),
     compilers: [:phoenix, :gettext] ++ Mix.compilers,
     start_permanent: Mix.env == :prod,
     aliases: aliases(),
     deps: deps()]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [mod: {Taskrr.Application, []},
     extra_applications: [:logger, :runtime_tools]]
  end
end

wdiechmann avatar Mar 17 '17 17:03 wdiechmann

Go right ahead and send in a pull request that adds it, and I'll be more than happy to merge.

jashkenas avatar Dec 19 '17 21:12 jashkenas