From 5f6a9d201fe9dd08cd1a926068dff220a36e341d Mon Sep 17 00:00:00 2001 From: Robert Prehn Date: Fri, 19 Mar 2021 19:32:18 +0000 Subject: [PATCH] BREAKING CHANGE: Namespace all framework modules under Legendary --- apps/admin/lib/admin.ex | 22 +++++++------- apps/admin/lib/admin/application.ex | 16 +++++----- apps/admin/lib/admin/channels/user_socket.ex | 6 ++-- apps/admin/lib/admin/endpoint.ex | 6 ++-- apps/admin/lib/admin/gettext.ex | 4 +-- apps/admin/lib/admin/repo.ex | 2 +- apps/admin/lib/admin/router.ex | 8 ++--- apps/admin/lib/admin/routes.ex | 2 +- apps/admin/lib/admin/telemetry.ex | 4 +-- apps/admin/lib/admin/views/error_helpers.ex | 10 +++---- apps/admin/lib/admin/views/error_view.ex | 4 +-- apps/admin/lib/admin/views/layout_view.ex | 4 +-- apps/admin/lib/admin/views/page_view.ex | 4 +-- apps/admin/lib/kaffy/config.ex | 4 +-- apps/admin/lib/kaffy/editor_extension.ex | 2 +- apps/admin/mix.exs | 4 +-- apps/admin/priv/repo/seeds.exs | 2 +- .../controllers/page_controller_test.exs | 4 +-- .../test/admin/views/error_helpers_test.exs | 6 ++-- .../test/admin/views/error_view_test.exs | 8 ++--- .../test/admin/views/layout_view_test.exs | 4 +-- .../admin/test/admin/views/page_view_test.exs | 4 +-- apps/admin/test/support/channel_case.ex | 12 ++++---- apps/admin/test/support/conn_case.ex | 14 ++++----- apps/admin/test/test_helper.exs | 2 +- apps/app/lib/app_web.ex | 2 +- apps/app/lib/app_web/router.ex | 6 ++-- .../app_web/templates/layout/_menu.html.eex | 4 +-- apps/app/lib/app_web/views/layout_view.ex | 4 +-- apps/app/test/app/views/layout_view_test.exs | 4 +-- apps/content/lib/content/application.ex | 18 +++++------ apps/content/lib/content/attachment.ex | 4 +-- apps/content/lib/content/comment.ex | 4 +-- apps/content/lib/content/comment_admin.ex | 2 +- apps/content/lib/content/commentmeta.ex | 2 +- apps/content/lib/content/comments.ex | 6 ++-- apps/content/lib/content/link.ex | 2 +- apps/content/lib/content/markup_field.ex | 4 +-- apps/content/lib/content/option.ex | 2 +- apps/content/lib/content/options.ex | 6 ++-- apps/content/lib/content/post.ex | 18 +++++------ apps/content/lib/content/post_admin.ex | 10 +++---- apps/content/lib/content/postmeta.ex | 4 +-- apps/content/lib/content/posts.ex | 10 +++---- apps/content/lib/content/repo.ex | 2 +- apps/content/lib/content/sitemap.ex | 6 ++-- apps/content/lib/content/sitemap_storage.ex | 4 +-- apps/content/lib/content/slugs.ex | 4 +-- apps/content/lib/content/term.ex | 2 +- apps/content/lib/content/term_relationship.ex | 12 ++++---- apps/content/lib/content/term_taxonomy.ex | 4 +-- apps/content/lib/content/termmeta.ex | 2 +- apps/content/lib/content/terms.ex | 6 ++-- apps/content/lib/content_web.ex | 24 +++++++-------- .../lib/content_web/channels/user_socket.ex | 6 ++-- .../controllers/comment_controller.ex | 11 ++++--- .../controllers/feeds_controller.ex | 6 ++-- .../controllers/post_password_controller.ex | 4 +-- .../controllers/posts_controller.ex | 8 ++--- .../controllers/sitemap_controller.ex | 6 ++-- apps/content/lib/content_web/endpoint.ex | 6 ++-- apps/content/lib/content_web/gettext.ex | 4 +-- apps/content/lib/content_web/router.ex | 8 ++--- apps/content/lib/content_web/routes.ex | 8 ++--- apps/content/lib/content_web/telemetry.ex | 4 +-- .../content_web/templates/feeds/index.rss.eex | 4 +-- .../templates/posts/comments.html.eex | 2 +- .../templates/posts/front.html.eex | 2 +- .../templates/posts/index.html.eex | 12 ++++---- .../templates/posts/pagination.html.eex | 4 +-- .../content_web/templates/posts/show.html.eex | 4 +-- .../posts/static_pages/index.html.eex | 6 ++-- .../templates/posts/thumb.html.eex | 4 +-- .../lib/content_web/views/admin_home_view.ex | 4 +-- .../lib/content_web/views/admin_posts_view.ex | 4 +-- .../lib/content_web/views/error_helpers.ex | 6 ++-- .../lib/content_web/views/error_view.ex | 4 +-- .../lib/content_web/views/feeds_view.ex | 8 ++--- .../lib/content_web/views/layout_view.ex | 26 ++++++++-------- .../lib/content_web/views/menus_view.ex | 4 +-- .../lib/content_web/views/page_view.ex | 4 +-- .../lib/content_web/views/posts_view.ex | 10 +++---- .../lib/content_web/views/sitemap_view.ex | 4 +-- apps/content/mix.exs | 4 +-- .../20180825175607_create_schema.exs | 2 +- .../20201009173604_add_oban_jobs_table.exs | 2 +- apps/content/priv/repo/seeds.exs | 2 +- apps/content/test/content/attachment_test.exs | 12 ++++---- .../content/test/content/commentmeta_test.exs | 6 ++-- apps/content/test/content/comments_test.exs | 6 ++-- apps/content/test/content/link_test.exs | 6 ++-- .../test/content/markup_field_test.exs | 6 ++-- apps/content/test/content/option_test.exs | 6 ++-- apps/content/test/content/options_test.exs | 6 ++-- apps/content/test/content/postmeta_test.exs | 6 ++-- apps/content/test/content/posts_test.exs | 6 ++-- apps/content/test/content/slugs_test.exs | 6 ++-- .../test/content/term_relationship_test.exs | 6 ++-- .../test/content/term_taxonomy_test.exs | 6 ++-- apps/content/test/content/term_test.exs | 6 ++-- apps/content/test/content/termmeta_test.exs | 6 ++-- .../controllers/comment_controller_test.exs | 8 ++--- .../controllers/feeds_controller_test.exs | 6 ++-- .../post_password_controller_test.exs | 5 ++-- .../controllers/posts_controller_test.exs | 15 +++++----- .../controllers/sitemap_controller_test.exs | 4 +-- .../content_web/views/error_view_test.exs | 8 ++--- .../content_web/views/layout_view_test.exs | 20 ++++++------- .../test/content_web/views/page_view_test.exs | 4 +-- .../content_web/views/posts_view_test.exs | 6 ++-- apps/content/test/support/channel_case.ex | 12 ++++---- apps/content/test/support/conn_case.ex | 16 +++++----- apps/content/test/support/data_case.ex | 10 +++---- apps/content/test/test_helper.exs | 2 +- apps/core/lib/auth.ex | 4 +-- apps/core/lib/auth/roles.ex | 4 +-- apps/core/lib/auth/user.ex | 4 +-- apps/core/lib/auth/user_admin.ex | 10 +++---- apps/core/lib/auth_web.ex | 28 ++++++++--------- apps/core/lib/auth_web/helpers.ex | 4 +-- apps/core/lib/auth_web/plugs/require_admin.ex | 4 +-- apps/core/lib/auth_web/pow/mailer.ex | 8 ++--- apps/core/lib/auth_web/views/error_view.ex | 4 +-- apps/core/lib/auth_web/views/layout_view.ex | 4 +-- apps/core/lib/auth_web/views/page_view.ex | 4 +-- .../core/lib/auth_web/views/pow/email_view.ex | 4 +-- .../auth_web/views/pow/registration_view.ex | 4 +-- .../lib/auth_web/views/pow/session_view.ex | 4 +-- .../pow_email_confirmation/mailer_view.ex | 4 +-- .../views/pow_reset_password/mailer_view.ex | 4 +-- .../pow_reset_password/reset_password_view.ex | 6 ++-- apps/core/lib/core.ex | 4 +-- apps/core/lib/core/application.ex | 18 +++++------ apps/core/lib/core/map_utils.ex | 2 +- apps/core/lib/core/repo.ex | 2 +- .../lib/core/shared_db_connection_pool.ex | 6 ++-- apps/core/lib/core_email.ex | 8 ++--- apps/core/lib/core_mailer.ex | 2 +- apps/core/lib/core_web.ex | 28 ++++++++--------- .../core/lib/core_web/channels/user_socket.ex | 6 ++-- apps/core/lib/core_web/endpoint.ex | 6 ++-- apps/core/lib/core_web/gettext.ex | 4 +-- apps/core/lib/core_web/router.ex | 6 ++-- apps/core/lib/core_web/telemetry.ex | 4 +-- .../lib/core_web/views/core_email_view.ex | 6 ++-- apps/core/lib/core_web/views/email_helpers.ex | 10 +++---- apps/core/lib/core_web/views/error_helpers.ex | 6 ++-- apps/core/lib/core_web/views/error_view.ex | 4 +-- apps/core/lib/core_web/views/helpers.ex | 6 ++-- apps/core/lib/core_web/views/layout_view.ex | 4 +-- apps/core/lib/i18n.ex | 2 +- apps/core/lib/mix/tasks/create_admin.ex | 4 +-- apps/core/mix.exs | 4 +-- .../20200714154549_create_users.exs | 2 +- ...21_add_pow_email_confirmation_to_users.exs | 2 +- .../20200717182733_add_roles_to_users.exs | 2 +- .../20200721214958_add_nicename_to_users.exs | 2 +- .../20200721215212_add_url_to_users.exs | 2 +- apps/core/priv/repo/seeds.exs | 2 +- apps/core/test/auth/roles_test.exs | 8 ++--- apps/core/test/auth/user_test.exs | 8 ++--- apps/core/test/auth_web/helpers_test.exs | 8 ++--- .../auth_web/plugs/require_admin_test.exs | 8 ++--- apps/core/test/auth_web/pow/mailer_test.exs | 6 ++-- .../test/auth_web/views/error_view_test.exs | 8 ++--- .../test/auth_web/views/layout_view_test.exs | 4 +-- .../test/auth_web/views/page_view_test.exs | 4 +-- apps/core/test/core/core_email_test.exs | 4 +-- apps/core/test/core/map_utils_test.exs | 6 ++-- .../core_web/views/email_helpers_test.exs | 8 ++--- .../core_web/views/error_helpers_test.exs | 6 ++-- .../test/core_web/views/error_view_test.exs | 8 ++--- .../core/test/core_web/views/helpers_test.exs | 8 ++--- .../test/core_web/views/layout_view_test.exs | 4 +-- .../test/core_web/views/page_view_test.exs | 4 +-- apps/core/test/mix/legendary_test.exs | 2 +- apps/core/test/support/channel_case.ex | 12 ++++---- apps/core/test/support/conn_case.ex | 14 ++++----- apps/core/test/support/data_case.ex | 12 ++++---- apps/core/test/test_helper.exs | 2 +- config/admin.exs | 20 ++++++------- config/config.exs | 30 +++++++++---------- config/dev.exs | 16 +++++----- config/prod.exs | 20 ++++++------- config/test.exs | 16 +++++----- mix.exs | 1 + 186 files changed, 619 insertions(+), 621 deletions(-) diff --git a/apps/admin/lib/admin.ex b/apps/admin/lib/admin.ex index d9e27293..189888db 100644 --- a/apps/admin/lib/admin.ex +++ b/apps/admin/lib/admin.ex @@ -1,12 +1,12 @@ -defmodule Admin do +defmodule Legendary.Admin do @moduledoc """ The entrypoint for defining your web interface, such as controllers, views, channels and so on. This can be used in your application as: - use Admin, :controller - use Admin, :view + use Legendary.Admin, :controller + use Legendary.Admin, :view The definitions below will be executed for every view, controller, etc, so keep them short and clean, focused @@ -19,11 +19,11 @@ defmodule Admin do def controller do quote do - use Phoenix.Controller, namespace: Admin + use Phoenix.Controller, namespace: Legendary.Admin import Plug.Conn - import Admin.Gettext - alias Admin.Router.Helpers, as: Routes + import Legendary.Admin.Gettext + alias Legendary.Admin.Router.Helpers, as: Routes end end @@ -31,7 +31,7 @@ defmodule Admin do quote do use Phoenix.View, root: "lib/admin/templates", - namespace: Admin + namespace: Legendary.Admin # Import convenience functions from controllers import Phoenix.Controller, @@ -54,7 +54,7 @@ defmodule Admin do def channel do quote do use Phoenix.Channel - import Admin.Gettext + import Legendary.Admin.Gettext end end @@ -66,9 +66,9 @@ defmodule Admin do # Import basic rendering functionality (render, render_layout, etc) import Phoenix.View - import Admin.ErrorHelpers - import Admin.Gettext - alias Admin.Router.Helpers, as: Routes + import Legendary.Admin.ErrorHelpers + import Legendary.Admin.Gettext + alias Legendary.Admin.Router.Helpers, as: Routes end end diff --git a/apps/admin/lib/admin/application.ex b/apps/admin/lib/admin/application.ex index 64c18713..1507c565 100644 --- a/apps/admin/lib/admin/application.ex +++ b/apps/admin/lib/admin/application.ex @@ -1,4 +1,4 @@ -defmodule Admin.Application do +defmodule Legendary.Admin.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false @@ -7,25 +7,25 @@ defmodule Admin.Application do def start(_type, _args) do children = [ - Admin.Repo, + Legendary.Admin.Repo, # Start the Telemetry supervisor - Admin.Telemetry, + Legendary.Admin.Telemetry, # Start the Endpoint (http/https) - Admin.Endpoint - # Start a worker by calling: Admin.Worker.start_link(arg) - # {Admin.Worker, arg} + Legendary.Admin.Endpoint + # Start a worker by calling: Legendary.Admin.Worker.start_link(arg) + # {Legendary.Admin.Worker, arg} ] # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options - opts = [strategy: :one_for_one, name: Admin.Supervisor] + opts = [strategy: :one_for_one, name: Legendary.Admin.Supervisor] Supervisor.start_link(children, opts) end # Tell Phoenix to update the endpoint configuration # whenever the application is updated. def config_change(changed, _new, removed) do - Admin.Endpoint.config_change(changed, removed) + Legendary.Admin.Endpoint.config_change(changed, removed) :ok end end diff --git a/apps/admin/lib/admin/channels/user_socket.ex b/apps/admin/lib/admin/channels/user_socket.ex index 28d4fc87..f8ec5bfd 100644 --- a/apps/admin/lib/admin/channels/user_socket.ex +++ b/apps/admin/lib/admin/channels/user_socket.ex @@ -1,8 +1,8 @@ -defmodule Admin.UserSocket do +defmodule Legendary.Admin.UserSocket do use Phoenix.Socket ## Channels - # channel "room:*", Admin.RoomChannel + # channel "room:*", Legendary.Admin.RoomChannel # Socket params are passed from the client and can # be used to verify and authenticate a user. After @@ -27,7 +27,7 @@ defmodule Admin.UserSocket do # Would allow you to broadcast a "disconnect" event and terminate # all active sockets and channels for a given user: # - # Admin.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{}) + # Legendary.Admin.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{}) # # Returning `nil` makes this socket anonymous. @impl true diff --git a/apps/admin/lib/admin/endpoint.ex b/apps/admin/lib/admin/endpoint.ex index 96378b61..db654fbd 100644 --- a/apps/admin/lib/admin/endpoint.ex +++ b/apps/admin/lib/admin/endpoint.ex @@ -1,4 +1,4 @@ -defmodule Admin.Endpoint do +defmodule Legendary.Admin.Endpoint do use Phoenix.Endpoint, otp_app: :admin def init(_, config) do @@ -17,7 +17,7 @@ defmodule Admin.Endpoint do signing_salt: "zGdDhvUt" ] - socket "/socket", Admin.UserSocket, + socket "/socket", Legendary.Admin.UserSocket, websocket: true, longpoll: false @@ -58,5 +58,5 @@ defmodule Admin.Endpoint do plug Plug.Head plug Plug.Session, @session_options plug Pow.Plug.Session, otp_app: :admin - plug Admin.Router + plug Legendary.Admin.Router end diff --git a/apps/admin/lib/admin/gettext.ex b/apps/admin/lib/admin/gettext.ex index 2834ccf2..2e514e64 100644 --- a/apps/admin/lib/admin/gettext.ex +++ b/apps/admin/lib/admin/gettext.ex @@ -1,11 +1,11 @@ -defmodule Admin.Gettext do +defmodule Legendary.Admin.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: - import Admin.Gettext + import Legendary.Admin.Gettext # Simple translation gettext("Here is the string to translate") diff --git a/apps/admin/lib/admin/repo.ex b/apps/admin/lib/admin/repo.ex index c40e6c5e..c7494cee 100644 --- a/apps/admin/lib/admin/repo.ex +++ b/apps/admin/lib/admin/repo.ex @@ -1,4 +1,4 @@ -defmodule Admin.Repo do +defmodule Legendary.Admin.Repo do use Ecto.Repo, otp_app: :admin, adapter: Ecto.Adapters.Postgres diff --git a/apps/admin/lib/admin/router.ex b/apps/admin/lib/admin/router.ex index 94ad84d5..63723e33 100644 --- a/apps/admin/lib/admin/router.ex +++ b/apps/admin/lib/admin/router.ex @@ -1,5 +1,5 @@ -defmodule Admin.Router do - use Admin, :router +defmodule Legendary.Admin.Router do + use Legendary.Admin, :router pipeline :browser do plug :accepts, ["html"] @@ -10,12 +10,12 @@ defmodule Admin.Router do end pipeline :require_admin do - plug AuthWeb.Plugs.RequireAdmin + plug Legendary.AuthWeb.Plugs.RequireAdmin end pipeline :api do plug :accepts, ["json"] end - use Admin.Routes + use Legendary.Admin.Routes end diff --git a/apps/admin/lib/admin/routes.ex b/apps/admin/lib/admin/routes.ex index 92fc4125..64d2b94c 100644 --- a/apps/admin/lib/admin/routes.ex +++ b/apps/admin/lib/admin/routes.ex @@ -1,4 +1,4 @@ -defmodule Admin.Routes do +defmodule Legendary.Admin.Routes do defmacro __using__(_opts \\ []) do quote do use Kaffy.Routes, scope: "/admin", pipe_through: [:require_admin] diff --git a/apps/admin/lib/admin/telemetry.ex b/apps/admin/lib/admin/telemetry.ex index a545e89c..44ee3dc0 100644 --- a/apps/admin/lib/admin/telemetry.ex +++ b/apps/admin/lib/admin/telemetry.ex @@ -1,4 +1,4 @@ -defmodule Admin.Telemetry do +defmodule Legendary.Admin.Telemetry do use Supervisor import Telemetry.Metrics @@ -49,7 +49,7 @@ defmodule Admin.Telemetry do [ # A module, function and arguments to be invoked periodically. # This function must call :telemetry.execute/3 and a metric must be added above. - # {Admin, :count_users, []} + # {Legendary.Admin, :count_users, []} ] end end diff --git a/apps/admin/lib/admin/views/error_helpers.ex b/apps/admin/lib/admin/views/error_helpers.ex index 7154dd65..890304e4 100644 --- a/apps/admin/lib/admin/views/error_helpers.ex +++ b/apps/admin/lib/admin/views/error_helpers.ex @@ -1,12 +1,12 @@ -defmodule Admin.ErrorHelpers do +defmodule Legendary.Admin.ErrorHelpers do @moduledoc """ Conveniences for translating and building error messages. """ use Phoenix.HTML - defdelegate error_tag(form, field), to: CoreWeb.ErrorHelpers - defdelegate error_tag(form, field, opts), to: CoreWeb.ErrorHelpers + defdelegate error_tag(form, field), to: Legendary.CoreWeb.ErrorHelpers + defdelegate error_tag(form, field, opts), to: Legendary.CoreWeb.ErrorHelpers @doc """ Translates an error message using gettext. @@ -30,9 +30,9 @@ defmodule Admin.ErrorHelpers do # should be written to the errors.po file. The :count option is # set by Ecto and indicates we should also apply plural rules. if count = opts[:count] do - Gettext.dngettext(Admin.Gettext, "errors", msg, msg, count, opts) + Gettext.dngettext(Legendary.Admin.Gettext, "errors", msg, msg, count, opts) else - Gettext.dgettext(Admin.Gettext, "errors", msg, opts) + Gettext.dgettext(Legendary.Admin.Gettext, "errors", msg, opts) end end end diff --git a/apps/admin/lib/admin/views/error_view.ex b/apps/admin/lib/admin/views/error_view.ex index f2e57b44..134ea57d 100644 --- a/apps/admin/lib/admin/views/error_view.ex +++ b/apps/admin/lib/admin/views/error_view.ex @@ -1,5 +1,5 @@ -defmodule Admin.ErrorView do - use Admin, :view +defmodule Legendary.Admin.ErrorView do + use Legendary.Admin, :view # If you want to customize a particular status code # for a certain format, you may uncomment below. diff --git a/apps/admin/lib/admin/views/layout_view.ex b/apps/admin/lib/admin/views/layout_view.ex index 745cc046..b01d71bb 100644 --- a/apps/admin/lib/admin/views/layout_view.ex +++ b/apps/admin/lib/admin/views/layout_view.ex @@ -1,3 +1,3 @@ -defmodule Admin.LayoutView do - use Admin, :view +defmodule Legendary.Admin.LayoutView do + use Legendary.Admin, :view end diff --git a/apps/admin/lib/admin/views/page_view.ex b/apps/admin/lib/admin/views/page_view.ex index 4cbfd520..5992b0c3 100644 --- a/apps/admin/lib/admin/views/page_view.ex +++ b/apps/admin/lib/admin/views/page_view.ex @@ -1,3 +1,3 @@ -defmodule Admin.PageView do - use Admin, :view +defmodule Legendary.Admin.PageView do + use Legendary.Admin, :view end diff --git a/apps/admin/lib/kaffy/config.ex b/apps/admin/lib/kaffy/config.ex index b103692a..431b809a 100644 --- a/apps/admin/lib/kaffy/config.ex +++ b/apps/admin/lib/kaffy/config.ex @@ -1,6 +1,6 @@ -defmodule Admin.Kaffy.Config do +defmodule Legendary.Admin.Kaffy.Config do def create_resources(_conn) do - config = Application.get_env(:admin, Admin) + config = Application.get_env(:admin, Legendary.Admin) {resources, _} = Keyword.pop(config, :resources, []) diff --git a/apps/admin/lib/kaffy/editor_extension.ex b/apps/admin/lib/kaffy/editor_extension.ex index ff65b150..bf0d0b5d 100644 --- a/apps/admin/lib/kaffy/editor_extension.ex +++ b/apps/admin/lib/kaffy/editor_extension.ex @@ -1,4 +1,4 @@ -defmodule Admin.Kaffy.EditorExtension do +defmodule Legendary.Admin.Kaffy.EditorExtension do def stylesheets(_conn) do [ {:safe, ~s()}, diff --git a/apps/admin/mix.exs b/apps/admin/mix.exs index 7bc29e75..380e63fe 100644 --- a/apps/admin/mix.exs +++ b/apps/admin/mix.exs @@ -1,4 +1,4 @@ -defmodule Admin.MixProject do +defmodule Legendary.Admin.MixProject do use Mix.Project def project do @@ -25,7 +25,7 @@ defmodule Admin.MixProject do # Type `mix help compile.app` for more information. def application do [ - mod: {Admin.Application, []}, + mod: {Legendary.Admin.Application, []}, extra_applications: [:logger, :runtime_tools] ] end diff --git a/apps/admin/priv/repo/seeds.exs b/apps/admin/priv/repo/seeds.exs index f67a3785..88c37a1b 100644 --- a/apps/admin/priv/repo/seeds.exs +++ b/apps/admin/priv/repo/seeds.exs @@ -5,7 +5,7 @@ # Inside the script, you can read and write to any of your # repositories directly: # -# Content.Repo.insert!(%Content.SomeSchema{}) +# Legendary.Content.Repo.insert!(%Legendary.Content.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fail if something goes wrong. diff --git a/apps/admin/test/admin/controllers/page_controller_test.exs b/apps/admin/test/admin/controllers/page_controller_test.exs index a81e3a75..93bbe035 100644 --- a/apps/admin/test/admin/controllers/page_controller_test.exs +++ b/apps/admin/test/admin/controllers/page_controller_test.exs @@ -1,3 +1,3 @@ -defmodule Admin.PageControllerTest do - use Admin.ConnCase +defmodule Legendary.Admin.PageControllerTest do + use Legendary.Admin.ConnCase end diff --git a/apps/admin/test/admin/views/error_helpers_test.exs b/apps/admin/test/admin/views/error_helpers_test.exs index dccc29bf..e7a35d7d 100644 --- a/apps/admin/test/admin/views/error_helpers_test.exs +++ b/apps/admin/test/admin/views/error_helpers_test.exs @@ -1,10 +1,10 @@ -defmodule Admin.ErrorHelpersTest do - use Admin.ConnCase +defmodule Legendary.Admin.ErrorHelpersTest do + use Legendary.Admin.ConnCase import Phoenix.HTML, only: [safe_to_string: 1] import Phoenix.HTML.Form, only: [form_for: 3] - import Admin.ErrorHelpers + import Legendary.Admin.ErrorHelpers def form do :example diff --git a/apps/admin/test/admin/views/error_view_test.exs b/apps/admin/test/admin/views/error_view_test.exs index 8d101c57..cc64fb34 100644 --- a/apps/admin/test/admin/views/error_view_test.exs +++ b/apps/admin/test/admin/views/error_view_test.exs @@ -1,14 +1,14 @@ -defmodule Admin.ErrorViewTest do - use Admin.ConnCase, async: true +defmodule Legendary.Admin.ErrorViewTest do + use Legendary.Admin.ConnCase, async: true # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View test "renders 404.html" do - assert render_to_string(Admin.ErrorView, "404.html", []) == "Not Found" + assert render_to_string(Legendary.Admin.ErrorView, "404.html", []) == "Not Found" end test "renders 500.html" do - assert render_to_string(Admin.ErrorView, "500.html", []) == "Internal Server Error" + assert render_to_string(Legendary.Admin.ErrorView, "500.html", []) == "Internal Server Error" end end diff --git a/apps/admin/test/admin/views/layout_view_test.exs b/apps/admin/test/admin/views/layout_view_test.exs index 37b6b079..186b83f7 100644 --- a/apps/admin/test/admin/views/layout_view_test.exs +++ b/apps/admin/test/admin/views/layout_view_test.exs @@ -1,5 +1,5 @@ -defmodule Admin.LayoutViewTest do - use Admin.ConnCase, async: true +defmodule Legendary.Admin.LayoutViewTest do + use Legendary.Admin.ConnCase, async: true # When testing helpers, you may want to import Phoenix.HTML and # use functions such as safe_to_string() to convert the helper diff --git a/apps/admin/test/admin/views/page_view_test.exs b/apps/admin/test/admin/views/page_view_test.exs index 85ce0a3d..53568cf6 100644 --- a/apps/admin/test/admin/views/page_view_test.exs +++ b/apps/admin/test/admin/views/page_view_test.exs @@ -1,3 +1,3 @@ -defmodule Admin.PageViewTest do - use Admin.ConnCase, async: true +defmodule Legendary.Admin.PageViewTest do + use Legendary.Admin.ConnCase, async: true end diff --git a/apps/admin/test/support/channel_case.ex b/apps/admin/test/support/channel_case.ex index 57fe6cf2..2fa05231 100644 --- a/apps/admin/test/support/channel_case.ex +++ b/apps/admin/test/support/channel_case.ex @@ -1,4 +1,4 @@ -defmodule Admin.ChannelCase do +defmodule Legendary.Admin.ChannelCase do @moduledoc """ This module defines the test case to be used by channel tests. @@ -11,7 +11,7 @@ defmodule Admin.ChannelCase do we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously - by setting `use Admin.ChannelCase, async: true`, although + by setting `use Legendary.Admin.ChannelCase, async: true`, although this option is not recommended for other databases. """ @@ -21,18 +21,18 @@ defmodule Admin.ChannelCase do quote do # Import conveniences for testing with channels import Phoenix.ChannelTest - import Admin.ChannelCase + import Legendary.Admin.ChannelCase # The default endpoint for testing - @endpoint Admin.Endpoint + @endpoint Legendary.Admin.Endpoint end end setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Admin.Repo) + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Legendary.Admin.Repo) unless tags[:async] do - Ecto.Adapters.SQL.Sandbox.mode(Admin.Repo, {:shared, self()}) + Ecto.Adapters.SQL.Sandbox.mode(Legendary.Admin.Repo, {:shared, self()}) end :ok diff --git a/apps/admin/test/support/conn_case.ex b/apps/admin/test/support/conn_case.ex index 073cd711..3a07db3d 100644 --- a/apps/admin/test/support/conn_case.ex +++ b/apps/admin/test/support/conn_case.ex @@ -1,4 +1,4 @@ -defmodule Admin.ConnCase do +defmodule Legendary.Admin.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. @@ -11,7 +11,7 @@ defmodule Admin.ConnCase do we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously - by setting `use Admin.ConnCase, async: true`, although + by setting `use Legendary.Admin.ConnCase, async: true`, although this option is not recommended for other databases. """ @@ -22,20 +22,20 @@ defmodule Admin.ConnCase do # Import conveniences for testing with connections import Plug.Conn import Phoenix.ConnTest - import Admin.ConnCase + import Legendary.Admin.ConnCase - alias Admin.Router.Helpers, as: Routes + alias Legendary.Admin.Router.Helpers, as: Routes # The default endpoint for testing - @endpoint Admin.Endpoint + @endpoint Legendary.Admin.Endpoint end end setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Admin.Repo) + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Legendary.Admin.Repo) unless tags[:async] do - Ecto.Adapters.SQL.Sandbox.mode(Admin.Repo, {:shared, self()}) + Ecto.Adapters.SQL.Sandbox.mode(Legendary.Admin.Repo, {:shared, self()}) end {:ok, conn: Phoenix.ConnTest.build_conn()} diff --git a/apps/admin/test/test_helper.exs b/apps/admin/test/test_helper.exs index 1a2391ba..f7a06b43 100644 --- a/apps/admin/test/test_helper.exs +++ b/apps/admin/test/test_helper.exs @@ -1,2 +1,2 @@ ExUnit.start() -Ecto.Adapters.SQL.Sandbox.mode(Admin.Repo, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Legendary.Admin.Repo, :manual) diff --git a/apps/app/lib/app_web.ex b/apps/app/lib/app_web.ex index 6814d321..808a9ccf 100644 --- a/apps/app/lib/app_web.ex +++ b/apps/app/lib/app_web.ex @@ -66,7 +66,7 @@ defmodule AppWeb do # Import basic rendering functionality (render, render_layout, etc) import Phoenix.View - import CoreWeb.Helpers + import Legendary.CoreWeb.Helpers import AppWeb.ErrorHelpers import AppWeb.Gettext alias AppWeb.Router.Helpers, as: Routes diff --git a/apps/app/lib/app_web/router.ex b/apps/app/lib/app_web/router.ex index 347991bb..0f01a0a4 100644 --- a/apps/app/lib/app_web/router.ex +++ b/apps/app/lib/app_web/router.ex @@ -4,7 +4,7 @@ defmodule AppWeb.Router do use Pow.Extension.Phoenix.Router, extensions: [PowResetPassword, PowEmailConfirmation] - alias AuthWeb.Plugs.{RequireAdmin} + alias Legendary.AuthWeb.Plugs.{RequireAdmin} pipeline :browser do plug :accepts, ["html"] @@ -57,6 +57,6 @@ defmodule AppWeb.Router do pow_extension_routes() end - use Admin.Routes - use Content.Routes + use Legendary.Admin.Routes + use Legendary.Content.Routes end diff --git a/apps/app/lib/app_web/templates/layout/_menu.html.eex b/apps/app/lib/app_web/templates/layout/_menu.html.eex index fc098bf6..cbfd3386 100644 --- a/apps/app/lib/app_web/templates/layout/_menu.html.eex +++ b/apps/app/lib/app_web/templates/layout/_menu.html.eex @@ -1,7 +1,7 @@