Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117918927
D169.1775420990.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
9 KB
Referenced Files
None
Subscribers
None
D169.1775420990.diff
View Options
diff --git a/larus/config/config.exs b/larus/config/config.exs
--- a/larus/config/config.exs
+++ b/larus/config/config.exs
@@ -9,7 +9,7 @@
config :larus, Larus.Endpoint,
url: [host: "localhost"],
root: Path.dirname(__DIR__),
- secret_key_base: "P4ngDTuHdlm7r4xqCkz1XwmyQoVJ8tJBDixcKVMEE6aVAwUsy59vZw/b/U7UgYpz",
+ secret_key_base: "P4ngDTuHdlm7r4xqCkz1XwmyQoVJ8tJBDixcKVMEE6aVAwUsy59vZw/b/",
render_errors: [accepts: ~w(html json)],
pubsub: [name: Larus.PubSub,
adapter: Phoenix.PubSub.PG2]
diff --git a/larus/lib/larus.ex b/larus/lib/larus.ex
--- a/larus/lib/larus.ex
+++ b/larus/lib/larus.ex
@@ -1,4 +1,7 @@
defmodule Larus do
+ @moduledoc """
+ Application
+ """
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
diff --git a/larus/lib/larus/endpoint.ex b/larus/lib/larus/endpoint.ex
--- a/larus/lib/larus/endpoint.ex
+++ b/larus/lib/larus/endpoint.ex
@@ -1,4 +1,8 @@
defmodule Larus.Endpoint do
+ @moduledoc """
+ Larus.Endpoint
+ """
+
use Phoenix.Endpoint, otp_app: :larus
socket "/socket", Larus.UserSocket
diff --git a/larus/lib/larus/repo.ex b/larus/lib/larus/repo.ex
--- a/larus/lib/larus/repo.ex
+++ b/larus/lib/larus/repo.ex
@@ -1,3 +1,6 @@
defmodule Larus.Repo do
+ @moduledoc """
+ Larus.Repo
+ """
use Ecto.Repo, otp_app: :larus
end
diff --git a/larus/mix.exs b/larus/mix.exs
--- a/larus/mix.exs
+++ b/larus/mix.exs
@@ -36,6 +36,7 @@
{:phoenix_html, "~> 2.4"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.9"},
+ {:dogma, "~> 0.1", only: :dev},
{:cowboy, "~> 1.0"}]
end
diff --git a/larus/test/support/model_case.ex b/larus/test/support/model_case.ex
--- a/larus/test/support/model_case.ex
+++ b/larus/test/support/model_case.ex
@@ -41,12 +41,12 @@
Given a User model that lists `:name` as a required field and validates
`:password` to be safe, it would return:
- iex> errors_on(%User{}, %{password: "password"})
+ iex> errors_on(%User{}, %{password: "pass"})
[password: "is unsafe", name: "is blank"]
You could then write your assertion like:
- assert {:password, "is unsafe"} in errors_on(%User{}, %{password: "password"})
+ assert {:password, "is unsafe"} in errors_on(%User{}, %{password: "pass"})
You can also create the changeset manually and retrieve the errors
field directly:
diff --git a/larus/test/test_helper.exs b/larus/test/test_helper.exs
--- a/larus/test/test_helper.exs
+++ b/larus/test/test_helper.exs
@@ -3,4 +3,3 @@
Mix.Task.run "ecto.create", ~w(-r Larus.Repo --quiet)
Mix.Task.run "ecto.migrate", ~w(-r Larus.Repo --quiet)
Ecto.Adapters.SQL.begin_test_transaction(Larus.Repo)
-
diff --git a/larus/test/views/layout_view_test.exs b/larus/test/views/layout_view_test.exs
--- a/larus/test/views/layout_view_test.exs
+++ b/larus/test/views/layout_view_test.exs
@@ -1,3 +1,3 @@
defmodule Larus.LayoutViewTest do
- use Larus.ConnCase, async: true
-end
\ No newline at end of file
+ use Larus.ConnCase, async: true
+end
diff --git a/larus/web/channels/user_socket.ex b/larus/web/channels/user_socket.ex
--- a/larus/web/channels/user_socket.ex
+++ b/larus/web/channels/user_socket.ex
@@ -1,10 +1,13 @@
defmodule Larus.UserSocket do
+ @moduledoc """
+ Larus.UserSocket
+ """
use Phoenix.Socket
- ## Channels
+ # ## Channels
# channel "rooms:*", Larus.RoomChannel
- ## Transports
+ # ## Transports
transport :websocket, Phoenix.Transports.WebSocket
# transport :longpoll, Phoenix.Transports.LongPoll
@@ -23,14 +26,15 @@
{:ok, socket}
end
- # Socket id's are topics that allow you to identify all sockets for a given user:
+ # Socket id's are topics that allow you to identify all sockets for a given
+ # user:
#
- # def id(socket), do: "users_socket:#{socket.assigns.user_id}"
+ # def id(socket), do: "users_socket:#{socket.assigns.user_id}"
#
# Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user:
#
- # Larus.Endpoint.broadcast("users_socket:#{user.id}", "disconnect", %{})
+ # Larus.Endpoint.broadcast("users_socket:#{user.id}", "disconnect", %{})
#
# Returning `nil` makes this socket anonymous.
def id(_socket), do: nil
diff --git a/larus/web/controllers/page_controller.ex b/larus/web/controllers/page_controller.ex
--- a/larus/web/controllers/page_controller.ex
+++ b/larus/web/controllers/page_controller.ex
@@ -1,7 +1,11 @@
defmodule Larus.PageController do
- use Larus.Web, :controller
+ @moduledoc """
+ Larus.PageController
+ """
- def index(conn, _params) do
- render conn, "index.html"
- end
+ use Larus.Web, :controller
+
+ def index(conn, _params) do
+ render conn, "index.html"
+ end
end
diff --git a/larus/web/gettext.ex b/larus/web/gettext.ex
--- a/larus/web/gettext.ex
+++ b/larus/web/gettext.ex
@@ -1,36 +1,37 @@
defmodule Larus.Gettext do
- @moduledoc """
- A module providing Internationalization with a gettext-based API.
+ @moduledoc """
+ A module providing Internationalization with a gettext-based API.
- By using [Gettext](http://hexdocs.pm/gettext),
- your module gains a set of macros for translations, for example:
+ By using [Gettext](http://hexdocs.pm/gettext),
+ your module gains a set of macros for translations, for example:
- import Larus.Gettext
+ import Larus.Gettext
- # Simple translation
- gettext "Here is the string to translate"
+ # Simple translation
+ gettext "Here is the string to translate"
- # Plural translation
- ngettext "Here is the string to translate",
- "Here are the strings to translate",
- 3
+ # Plural translation
+ ngettext "Here is the string to translate",
+ "Here are the strings to translate",
+ 3
- # Domain-based translation
- dgettext "errors", "Here is the error message to translate"
+ # Domain-based translation
+ dgettext "errors", "Here is the error message to translate"
- See the [Gettext Docs](http://hexdocs.pm/gettext) for detailed usage.
- """
- use Gettext, otp_app: :larus
+ See the [Gettext Docs](http://hexdocs.pm/gettext) for detailed usage.
+ """
- def supported_locales do
- known = Gettext.known_locales(Larus.Gettext)
- allowed = config[:locales]
+ use Gettext, otp_app: :larus
- Set.intersection(Enum.into(known, HashSet.new), Enum.into(allowed, HashSet.new))
- |> Set.to_list
- end
+ def supported_locales do
+ known = Gettext.known_locales(Larus.Gettext)
+ allowed = config[:locales]
- defp config do
- Application.get_env(:larus, __MODULE__)
- end
+ Set.intersection(Enum.into(known, HashSet.new), Enum.into(allowed, HashSet.new))
+ |> Set.to_list
+ end
+
+ defp config do
+ Application.get_env(:larus, __MODULE__)
+ end
end
diff --git a/larus/web/router.ex b/larus/web/router.ex
--- a/larus/web/router.ex
+++ b/larus/web/router.ex
@@ -1,4 +1,8 @@
defmodule Larus.Router do
+ @moduledoc """
+ Larus.Router
+ """
+
use Larus.Web, :router
pipeline :browser do
diff --git a/larus/web/views/error_helpers.ex b/larus/web/views/error_helpers.ex
--- a/larus/web/views/error_helpers.ex
+++ b/larus/web/views/error_helpers.ex
@@ -9,8 +9,9 @@
Generates tag for inlined form input errors.
"""
def error_tag(form, field) do
- if error = form.errors[field] do
- content_tag :span, translate_error(error), class: "help-block"
+ error = form.errors[field]
+ if error do
+ content_tag :span, translate_error(error), class: "help-block"
end
end
@@ -26,6 +27,7 @@
#
# dngettext "errors", "1 file", "%{count} files", count
#
+
Gettext.dngettext(Larus.Gettext, "errors", msg, msg, opts[:count], opts)
end
diff --git a/larus/web/views/error_view.ex b/larus/web/views/error_view.ex
--- a/larus/web/views/error_view.ex
+++ b/larus/web/views/error_view.ex
@@ -1,4 +1,8 @@
defmodule Larus.ErrorView do
+ @moduledoc """
+ Views on errors
+ """
+
use Larus.Web, :view
def render("404.html", _assigns) do
diff --git a/larus/web/views/layout_view.ex b/larus/web/views/layout_view.ex
--- a/larus/web/views/layout_view.ex
+++ b/larus/web/views/layout_view.ex
@@ -1,15 +1,19 @@
defmodule Larus.LayoutView do
- use Larus.Web, :view
+ @moduledoc """
+ A layout view.
+ """
- def author do
- "Kolab Systems AG"
- end
+ use Larus.Web, :view
- def description do
- gettext "Larus flying high."
- end
+ def author do
+ "Kolab Systems AG"
+ end
- def title do
- gettext "[YOUR TITLE HERE]"
- end
+ def description do
+ gettext "Larus flying high."
+ end
+
+ def title do
+ gettext "[YOUR TITLE HERE]"
+ end
end
diff --git a/larus/web/views/page_view.ex b/larus/web/views/page_view.ex
--- a/larus/web/views/page_view.ex
+++ b/larus/web/views/page_view.ex
@@ -1,3 +1,7 @@
defmodule Larus.PageView do
+ @moduledoc """
+ The Larus page view
+ """
+
use Larus.Web, :view
end
diff --git a/larus/web/web.ex b/larus/web/web.ex
--- a/larus/web/web.ex
+++ b/larus/web/web.ex
@@ -44,7 +44,8 @@
use Phoenix.View, root: "web/templates"
# Import convenience functions from controllers
- import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1]
+ import Phoenix.Controller, only:
+ [get_csrf_token: 0, get_flash: 2, view_module: 1]
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 8:29 PM (3 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18834385
Default Alt Text
D169.1775420990.diff (9 KB)
Attached To
Mode
D169: Use dogma to ensure a coding style
Attached
Detach File
Event Timeline