Skip to content

Instantly share code, notes, and snippets.

@jalcine
Last active April 20, 2016 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalcine/b7f85296a0872b81d866353a745b05e1 to your computer and use it in GitHub Desktop.
Save jalcine/b7f85296a0872b81d866353a745b05e1 to your computer and use it in GitHub Desktop.
# Command run by neomake: mix compile.elixir --warnings-as-errors ~prj/web/models/hashtag.ex
Neomake: mix stdout: Compiled lib/api.ex
Neomake: mix stdout:
Neomake: mix stdout done.
Neomake: mix processing 2 lines of output
Neomake: mix stdout: Compiled web/web.ex
Neomake: mix stdout:
Neomake: mix stdout done.
Neomake: mix processing 2 lines of output
Neomake: mix stdout:
Neomake: mix stdout: == Compilation error on file web/views/error_helpers.ex ==
Neomake: mix stdout:
Neomake: mix stdout done.
Neomake: mix processing 3 lines of output
Neomake: mix stdout: ** (CompileError) web/views/error_helpers.ex:6: module Phoenix.HTML is not loaded and could not be found
Neomake: mix stdout: (elixir) expanding macro: Kernel.use/1
Neomake: mix stdout: web/views/error_helpers.ex:6: Twchat.ErrorHelpers (module)
Neomake: mix stdout: (elixir) lib/kernel/parallel_compiler.ex:101: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8
Neomake: mix stdout:
Neomake: mix stdout:
Neomake: mix stdout done.
Neomake: mix processing 6 lines of output
defmodule Twchat.Hashtag do
use Twchat.Web, :model
schema "hashtags" do
field :display_name, :string
field :tag, :string
field :uri, :string
field :description, :string
timestamps
end
@required_fields ~w(tag)
@optional_fields ~w(display_name uri description)
@doc """
Creates a changeset based on the `model` and `params`.
If no params are provided, an invalid changeset is returned
with no validation performed.
"""
def changeset(model, params \\ :empty) do
model
|> cast(params, @required_fields, @optional_fields)
|> unique_constraint(:tag)
# TODO: Check if tag is unique.
# TODO: Check that uri, if provided, is a valid URI.
end
end
defmodule Twchat.Mixfile do
@moduledoc """
Dependencies and definitions for twchat.
"""
use Mix.Project
def project do
[app: :api,
version: "0.0.1",
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
aliases: aliases,
test_coverage: [tool: ExCoveralls],
# preferred_cli_env: [
# vcr: :test,
# "vcr.delete": :test,
# "vcr.check": :test,
# "vcr.show": :test
# ],
deps: deps]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[mod: {Twchat, []},
applications: [
:phoenix,
:phoenix_html,
:cowboy,
:logger,
:gettext,
:phoenix_ecto,
:postgrex,
]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "web", "test/support", "test/factories"]
defp elixirc_paths(_), do: ["lib", "web"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.1.4"},
{:postgrex, ">= 0.0.0"},
{:geo, "~> 1.0.2"},
{:phoenix_ecto, "~> 2.0"},
{:phoenix_html, "~> 2.4"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.9"},
{:cowboy, "~> 1.0"},
# {:conform, "~> 2.0.0"},
# {:conform_exrm, "~> 1.0.0"},
# {:arc, "~> 0.5.1"},
# {:extwitter, "~> 0.7.0"},
# {:exrm, "~> 1.0.0"},
# {:exrm_docker, "~> 0.0.4"},
# {:quantum, ">= 1.7.1"},
# {:jose, "~> 1.7"},
{:ex_machina, "~> 0.6.1", only: :test},
{:faker, "~> 0.5", only: :test},
{:exvcr, "~> 0.7", only: :test},
{:excoveralls, "~> 0.4", only: :test},
{:credo, "~> 0.3", only: [:dev, :test]},
{:ex_unit_notifier, "0.1.0", only: :test},
{:ex_spec, "~> 1.0.0", only: :test}
]
end
# Aliases are shortcut or tasks specific to the current project.
# For example, to create, migrate and run the seeds file at once:
#
# $ mix ecto.setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
["ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"]]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment