feat: Rename content to content_web
This commit is contained in:
parent
641bce3c71
commit
d1242ee0db
55 changed files with 107 additions and 107 deletions
|
@ -1,3 +0,0 @@
|
||||||
defmodule Content.LayoutView do
|
|
||||||
use Content, :view
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
defmodule Content.PageView do
|
|
||||||
use Content, :view
|
|
||||||
end
|
|
|
@ -1,14 +0,0 @@
|
||||||
defmodule Content.ErrorViewTest do
|
|
||||||
use Content.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(Content.ErrorView, "404.html", []) == "Not Found"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "renders 500.html" do
|
|
||||||
assert render_to_string(Content.ErrorView, "500.html", []) == "Internal Server Error"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
defmodule Content.PageViewTest do
|
|
||||||
use Content.ConnCase, async: true
|
|
||||||
end
|
|
|
@ -1,2 +0,0 @@
|
||||||
ExUnit.start()
|
|
||||||
# Ecto.Adapters.SQL.Sandbox.mode(Content.Repo, :manual)
|
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -1,12 +1,12 @@
|
||||||
defmodule Content do
|
defmodule ContentWeb do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
The entrypoint for defining your web interface, such
|
The entrypoint for defining your web interface, such
|
||||||
as controllers, views, channels and so on.
|
as controllers, views, channels and so on.
|
||||||
|
|
||||||
This can be used in your application as:
|
This can be used in your application as:
|
||||||
|
|
||||||
use Content, :controller
|
use ContentWeb, :controller
|
||||||
use Content, :view
|
use ContentWeb, :view
|
||||||
|
|
||||||
The definitions below will be executed for every view,
|
The definitions below will be executed for every view,
|
||||||
controller, etc, so keep them short and clean, focused
|
controller, etc, so keep them short and clean, focused
|
||||||
|
@ -19,19 +19,19 @@ defmodule Content do
|
||||||
|
|
||||||
def controller do
|
def controller do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Controller, namespace: Content
|
use Phoenix.Controller, namespace: ContentWeb
|
||||||
|
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import Content.Gettext
|
import ContentWeb.Gettext
|
||||||
alias Content.Router.Helpers, as: Routes
|
alias ContentWeb.Router.Helpers, as: Routes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def view do
|
def view do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.View,
|
use Phoenix.View,
|
||||||
root: "lib/content/templates",
|
root: "lib/content_web/templates",
|
||||||
namespace: Content,
|
namespace: ContentWeb,
|
||||||
pattern: "**/*"
|
pattern: "**/*"
|
||||||
|
|
||||||
# Import convenience functions from controllers
|
# Import convenience functions from controllers
|
||||||
|
@ -55,7 +55,7 @@ defmodule Content do
|
||||||
def channel do
|
def channel do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Channel
|
use Phoenix.Channel
|
||||||
import Content.Gettext
|
import ContentWeb.Gettext
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -67,9 +67,9 @@ defmodule Content do
|
||||||
# Import basic rendering functionality (render, render_layout, etc)
|
# Import basic rendering functionality (render, render_layout, etc)
|
||||||
import Phoenix.View
|
import Phoenix.View
|
||||||
|
|
||||||
import Content.ErrorHelpers
|
import ContentWeb.ErrorHelpers
|
||||||
import Content.Gettext
|
import ContentWeb.Gettext
|
||||||
alias Content.Router.Helpers, as: Routes
|
alias ContentWeb.Router.Helpers, as: Routes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Content.Application do
|
defmodule ContentWeb.Application do
|
||||||
# See https://hexdocs.pm/elixir/Application.html
|
# See https://hexdocs.pm/elixir/Application.html
|
||||||
# for more information on OTP Applications
|
# for more information on OTP Applications
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
@ -8,23 +8,23 @@ defmodule Content.Application do
|
||||||
def start(_type, _args) do
|
def start(_type, _args) do
|
||||||
children = [
|
children = [
|
||||||
# Start the Telemetry supervisor
|
# Start the Telemetry supervisor
|
||||||
Content.Telemetry,
|
ContentWeb.Telemetry,
|
||||||
# Start the Endpoint (http/https)
|
# Start the Endpoint (http/https)
|
||||||
Content.Endpoint
|
ContentWeb.Endpoint
|
||||||
# Start a worker by calling: Content.Worker.start_link(arg)
|
# Start a worker by calling: ContentWeb.Worker.start_link(arg)
|
||||||
# {Content.Worker, arg}
|
# {ContentWeb.Worker, arg}
|
||||||
]
|
]
|
||||||
|
|
||||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||||
# for other strategies and supported options
|
# for other strategies and supported options
|
||||||
opts = [strategy: :one_for_one, name: Content.Supervisor]
|
opts = [strategy: :one_for_one, name: ContentWeb.Supervisor]
|
||||||
Supervisor.start_link(children, opts)
|
Supervisor.start_link(children, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tell Phoenix to update the endpoint configuration
|
# Tell Phoenix to update the endpoint configuration
|
||||||
# whenever the application is updated.
|
# whenever the application is updated.
|
||||||
def config_change(changed, _new, removed) do
|
def config_change(changed, _new, removed) do
|
||||||
Content.Endpoint.config_change(changed, removed)
|
ContentWeb.Endpoint.config_change(changed, removed)
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,8 +1,8 @@
|
||||||
defmodule Content.UserSocket do
|
defmodule ContentWeb.UserSocket do
|
||||||
use Phoenix.Socket
|
use Phoenix.Socket
|
||||||
|
|
||||||
## Channels
|
## Channels
|
||||||
# channel "room:*", Content.RoomChannel
|
# channel "room:*", ContentWeb.RoomChannel
|
||||||
|
|
||||||
# Socket params are passed from the client and can
|
# Socket params are passed from the client and can
|
||||||
# be used to verify and authenticate a user. After
|
# be used to verify and authenticate a user. After
|
||||||
|
@ -27,7 +27,7 @@ defmodule Content.UserSocket do
|
||||||
# Would allow you to broadcast a "disconnect" event and terminate
|
# Would allow you to broadcast a "disconnect" event and terminate
|
||||||
# all active sockets and channels for a given user:
|
# all active sockets and channels for a given user:
|
||||||
#
|
#
|
||||||
# Content.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
|
# ContentWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
|
||||||
#
|
#
|
||||||
# Returning `nil` makes this socket anonymous.
|
# Returning `nil` makes this socket anonymous.
|
||||||
@impl true
|
@impl true
|
|
@ -1,5 +1,5 @@
|
||||||
defmodule Content.PageController do
|
defmodule ContentWeb.PageController do
|
||||||
use Content, :controller
|
use ContentWeb, :controller
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
render(conn, "index.html")
|
render(conn, "index.html")
|
|
@ -1,5 +1,5 @@
|
||||||
defmodule Content.Endpoint do
|
defmodule ContentWeb.Endpoint do
|
||||||
use Phoenix.Endpoint, otp_app: :content
|
use Phoenix.Endpoint, otp_app: :content_web
|
||||||
|
|
||||||
# The session will be stored in the cookie and signed,
|
# The session will be stored in the cookie and signed,
|
||||||
# this means its contents can be read but not tampered with.
|
# this means its contents can be read but not tampered with.
|
||||||
|
@ -10,7 +10,7 @@ defmodule Content.Endpoint do
|
||||||
signing_salt: "wfYQp84C"
|
signing_salt: "wfYQp84C"
|
||||||
]
|
]
|
||||||
|
|
||||||
socket "/socket", Content.UserSocket,
|
socket "/socket", ContentWeb.UserSocket,
|
||||||
websocket: true,
|
websocket: true,
|
||||||
longpoll: false
|
longpoll: false
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ defmodule Content.Endpoint do
|
||||||
# when deploying your static files in production.
|
# when deploying your static files in production.
|
||||||
plug Plug.Static,
|
plug Plug.Static,
|
||||||
at: "/",
|
at: "/",
|
||||||
from: :content,
|
from: :content_web,
|
||||||
gzip: false,
|
gzip: false,
|
||||||
only: ~w(css fonts images js favicon.ico robots.txt)
|
only: ~w(css fonts images js favicon.ico robots.txt)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ defmodule Content.Endpoint do
|
||||||
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
|
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
|
||||||
plug Phoenix.LiveReloader
|
plug Phoenix.LiveReloader
|
||||||
plug Phoenix.CodeReloader
|
plug Phoenix.CodeReloader
|
||||||
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :content
|
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :content_web
|
||||||
end
|
end
|
||||||
|
|
||||||
plug Phoenix.LiveDashboard.RequestLogger,
|
plug Phoenix.LiveDashboard.RequestLogger,
|
||||||
|
@ -50,6 +50,6 @@ defmodule Content.Endpoint do
|
||||||
plug Plug.MethodOverride
|
plug Plug.MethodOverride
|
||||||
plug Plug.Head
|
plug Plug.Head
|
||||||
plug Plug.Session, @session_options
|
plug Plug.Session, @session_options
|
||||||
plug Pow.Plug.Session, otp_app: :content
|
plug Pow.Plug.Session, otp_app: :content_web
|
||||||
plug Content.Router
|
plug ContentWeb.Router
|
||||||
end
|
end
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule Content.Gettext do
|
defmodule ContentWeb.Gettext do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
A module providing Internationalization with a gettext-based API.
|
A module providing Internationalization with a gettext-based API.
|
||||||
|
|
||||||
By using [Gettext](https://hexdocs.pm/gettext),
|
By using [Gettext](https://hexdocs.pm/gettext),
|
||||||
your module gains a set of macros for translations, for example:
|
your module gains a set of macros for translations, for example:
|
||||||
|
|
||||||
import Content.Gettext
|
import ContentWeb.Gettext
|
||||||
|
|
||||||
# Simple translation
|
# Simple translation
|
||||||
gettext("Here is the string to translate")
|
gettext("Here is the string to translate")
|
||||||
|
@ -20,5 +20,5 @@ defmodule Content.Gettext do
|
||||||
|
|
||||||
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
||||||
"""
|
"""
|
||||||
use Gettext, otp_app: :content
|
use Gettext, otp_app: :content_web
|
||||||
end
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
defmodule Content.Router do
|
defmodule ContentWeb.Router do
|
||||||
use Content, :router
|
use ContentWeb, :router
|
||||||
|
|
||||||
pipeline :browser do
|
pipeline :browser do
|
||||||
plug :accepts, ["html"]
|
plug :accepts, ["html"]
|
||||||
|
@ -13,7 +13,7 @@ defmodule Content.Router do
|
||||||
plug :accepts, ["json"]
|
plug :accepts, ["json"]
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/", Content do
|
scope "/", ContentWeb do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
get "/:id", PageController, :show
|
get "/:id", PageController, :show
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Content.Telemetry do
|
defmodule ContentWeb.Telemetry do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Collects metrics for the application and allows them to be transmitted using the Telemetry framework.
|
Collects metrics for the application and allows them to be transmitted using the Telemetry framework.
|
||||||
"""
|
"""
|
||||||
|
@ -34,11 +34,11 @@ defmodule Content.Telemetry do
|
||||||
),
|
),
|
||||||
|
|
||||||
# Database Metrics
|
# Database Metrics
|
||||||
summary("content.repo.query.total_time", unit: {:native, :millisecond}),
|
summary("content_web.repo.query.total_time", unit: {:native, :millisecond}),
|
||||||
summary("content.repo.query.decode_time", unit: {:native, :millisecond}),
|
summary("content_web.repo.query.decode_time", unit: {:native, :millisecond}),
|
||||||
summary("content.repo.query.query_time", unit: {:native, :millisecond}),
|
summary("content_web.repo.query.query_time", unit: {:native, :millisecond}),
|
||||||
summary("content.repo.query.queue_time", unit: {:native, :millisecond}),
|
summary("content_web.repo.query.queue_time", unit: {:native, :millisecond}),
|
||||||
summary("content.repo.query.idle_time", unit: {:native, :millisecond}),
|
summary("content_web.repo.query.idle_time", unit: {:native, :millisecond}),
|
||||||
|
|
||||||
# VM Metrics
|
# VM Metrics
|
||||||
summary("vm.memory.total", unit: {:byte, :kilobyte}),
|
summary("vm.memory.total", unit: {:byte, :kilobyte}),
|
||||||
|
@ -52,7 +52,7 @@ defmodule Content.Telemetry do
|
||||||
[
|
[
|
||||||
# A module, function and arguments to be invoked periodically.
|
# A module, function and arguments to be invoked periodically.
|
||||||
# This function must call :telemetry.execute/3 and a metric must be added above.
|
# This function must call :telemetry.execute/3 and a metric must be added above.
|
||||||
# {Content, :count_users, []}
|
# {ContentWeb, :count_users, []}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Content.ErrorHelpers do
|
defmodule ContentWeb.ErrorHelpers do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Conveniences for translating and building error messages.
|
Conveniences for translating and building error messages.
|
||||||
"""
|
"""
|
||||||
|
@ -39,9 +39,9 @@ defmodule Content.ErrorHelpers do
|
||||||
# should be written to the errors.po file. The :count option is
|
# should be written to the errors.po file. The :count option is
|
||||||
# set by Ecto and indicates we should also apply plural rules.
|
# set by Ecto and indicates we should also apply plural rules.
|
||||||
if count = opts[:count] do
|
if count = opts[:count] do
|
||||||
Gettext.dngettext(Content.Gettext, "errors", msg, msg, count, opts)
|
Gettext.dngettext(ContentWeb.Gettext, "errors", msg, msg, count, opts)
|
||||||
else
|
else
|
||||||
Gettext.dgettext(Content.Gettext, "errors", msg, opts)
|
Gettext.dgettext(ContentWeb.Gettext, "errors", msg, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
defmodule Content.ErrorView do
|
defmodule ContentWeb.ErrorView do
|
||||||
use Content, :view
|
use ContentWeb, :view
|
||||||
|
|
||||||
# If you want to customize a particular status code
|
# If you want to customize a particular status code
|
||||||
# for a certain format, you may uncomment below.
|
# for a certain format, you may uncomment below.
|
3
apps/content_web/lib/content_web/views/layout_view.ex
Normal file
3
apps/content_web/lib/content_web/views/layout_view.ex
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
defmodule ContentWeb.LayoutView do
|
||||||
|
use ContentWeb, :view
|
||||||
|
end
|
3
apps/content_web/lib/content_web/views/page_view.ex
Normal file
3
apps/content_web/lib/content_web/views/page_view.ex
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
defmodule ContentWeb.PageView do
|
||||||
|
use ContentWeb, :view
|
||||||
|
end
|
|
@ -1,9 +1,9 @@
|
||||||
defmodule Content.MixProject do
|
defmodule ContentWeb.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :content,
|
app: :content_web,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
config_path: "../../config/config.exs",
|
config_path: "../../config/config.exs",
|
||||||
|
@ -24,7 +24,7 @@ defmodule Content.MixProject do
|
||||||
# Type `mix help compile.app` for more information.
|
# Type `mix help compile.app` for more information.
|
||||||
def application do
|
def application do
|
||||||
[
|
[
|
||||||
mod: {Content.Application, []},
|
mod: {ContentWeb.Application, []},
|
||||||
extra_applications: [:logger, :runtime_tools]
|
extra_applications: [:logger, :runtime_tools]
|
||||||
]
|
]
|
||||||
end
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
defmodule Content.PageControllerTest do
|
defmodule ContentWeb.PageControllerTest do
|
||||||
use Content.ConnCase
|
use ContentWeb.ConnCase
|
||||||
|
|
||||||
test "GET /", %{conn: conn} do
|
test "GET /", %{conn: conn} do
|
||||||
conn = get(conn, "/index")
|
conn = get(conn, "/index")
|
14
apps/content_web/test/content/views/error_view_test.exs
Normal file
14
apps/content_web/test/content/views/error_view_test.exs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
defmodule ContentWeb.ErrorViewTest do
|
||||||
|
use ContentWeb.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(ContentWeb.ErrorView, "404.html", []) == "Not Found"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "renders 500.html" do
|
||||||
|
assert render_to_string(ContentWeb.ErrorView, "500.html", []) == "Internal Server Error"
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
defmodule Content.LayoutViewTest do
|
defmodule ContentWeb.LayoutViewTest do
|
||||||
use Content.ConnCase, async: true
|
use ContentWeb.ConnCase, async: true
|
||||||
|
|
||||||
# When testing helpers, you may want to import Phoenix.HTML and
|
# When testing helpers, you may want to import Phoenix.HTML and
|
||||||
# use functions such as safe_to_string() to convert the helper
|
# use functions such as safe_to_string() to convert the helper
|
3
apps/content_web/test/content/views/page_view_test.exs
Normal file
3
apps/content_web/test/content/views/page_view_test.exs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
defmodule ContentWeb.PageViewTest do
|
||||||
|
use ContentWeb.ConnCase, async: true
|
||||||
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Content.ChannelCase do
|
defmodule ContentWeb.ChannelCase do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
This module defines the test case to be used by
|
This module defines the test case to be used by
|
||||||
channel tests.
|
channel tests.
|
||||||
|
@ -11,7 +11,7 @@ defmodule Content.ChannelCase do
|
||||||
we enable the SQL sandbox, so changes done to the database
|
we enable the SQL sandbox, so changes done to the database
|
||||||
are reverted at the end of every test. If you are using
|
are reverted at the end of every test. If you are using
|
||||||
PostgreSQL, you can even run database tests asynchronously
|
PostgreSQL, you can even run database tests asynchronously
|
||||||
by setting `use Content.ChannelCase, async: true`, although
|
by setting `use ContentWeb.ChannelCase, async: true`, although
|
||||||
this option is not recommended for other databases.
|
this option is not recommended for other databases.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -21,18 +21,18 @@ defmodule Content.ChannelCase do
|
||||||
quote do
|
quote do
|
||||||
# Import conveniences for testing with channels
|
# Import conveniences for testing with channels
|
||||||
import Phoenix.ChannelTest
|
import Phoenix.ChannelTest
|
||||||
import Content.ChannelCase
|
import ContentWeb.ChannelCase
|
||||||
|
|
||||||
# The default endpoint for testing
|
# The default endpoint for testing
|
||||||
@endpoint Content.Endpoint
|
@endpoint ContentWeb.Endpoint
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
setup tags do
|
setup tags do
|
||||||
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(Content.Repo)
|
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(ContentWeb.Repo)
|
||||||
|
|
||||||
unless tags[:async] do
|
unless tags[:async] do
|
||||||
# Ecto.Adapters.SQL.Sandbox.mode(Content.Repo, {:shared, self()})
|
# Ecto.Adapters.SQL.Sandbox.mode(ContentWeb.Repo, {:shared, self()})
|
||||||
end
|
end
|
||||||
|
|
||||||
:ok
|
:ok
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Content.ConnCase do
|
defmodule ContentWeb.ConnCase do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
This module defines the test case to be used by
|
This module defines the test case to be used by
|
||||||
tests that require setting up a connection.
|
tests that require setting up a connection.
|
||||||
|
@ -11,7 +11,7 @@ defmodule Content.ConnCase do
|
||||||
we enable the SQL sandbox, so changes done to the database
|
we enable the SQL sandbox, so changes done to the database
|
||||||
are reverted at the end of every test. If you are using
|
are reverted at the end of every test. If you are using
|
||||||
PostgreSQL, you can even run database tests asynchronously
|
PostgreSQL, you can even run database tests asynchronously
|
||||||
by setting `use Content.ConnCase, async: true`, although
|
by setting `use ContentWeb.ConnCase, async: true`, although
|
||||||
this option is not recommended for other databases.
|
this option is not recommended for other databases.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -22,20 +22,20 @@ defmodule Content.ConnCase do
|
||||||
# Import conveniences for testing with connections
|
# Import conveniences for testing with connections
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import Phoenix.ConnTest
|
import Phoenix.ConnTest
|
||||||
import Content.ConnCase
|
import ContentWeb.ConnCase
|
||||||
|
|
||||||
alias Content.Router.Helpers, as: Routes
|
alias ContentWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
# The default endpoint for testing
|
# The default endpoint for testing
|
||||||
@endpoint Content.Endpoint
|
@endpoint ContentWeb.Endpoint
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
setup tags do
|
setup tags do
|
||||||
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(Content.Repo)
|
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(ContentWeb.Repo)
|
||||||
|
|
||||||
unless tags[:async] do
|
unless tags[:async] do
|
||||||
# Ecto.Adapters.SQL.Sandbox.mode(Content.Repo, {:shared, self()})
|
# Ecto.Adapters.SQL.Sandbox.mode(ContentWeb.Repo, {:shared, self()})
|
||||||
end
|
end
|
||||||
|
|
||||||
{:ok, conn: Phoenix.ConnTest.build_conn()}
|
{:ok, conn: Phoenix.ConnTest.build_conn()}
|
2
apps/content_web/test/test_helper.exs
Normal file
2
apps/content_web/test/test_helper.exs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ExUnit.start()
|
||||||
|
# Ecto.Adapters.SQL.Sandbox.mode(ContentWeb.Repo, :manual)
|
|
@ -27,7 +27,7 @@ defmodule CoreWeb.Router do
|
||||||
forward "/sent_emails", Bamboo.SentEmailViewerPlug
|
forward "/sent_emails", Bamboo.SentEmailViewerPlug
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/", Content do
|
scope "/", ContentWeb do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
get "/", PageController, :index
|
get "/", PageController, :index
|
||||||
|
|
|
@ -26,13 +26,13 @@ config :auth_web, AuthWeb.Endpoint,
|
||||||
live_view: [signing_salt: "AwljJYaY"]
|
live_view: [signing_salt: "AwljJYaY"]
|
||||||
|
|
||||||
config :core,
|
config :core,
|
||||||
router_forwards: [{Content.Router, "/pages"}, {AuthWeb.Router, "/auth"}],
|
router_forwards: [{ContentWeb.Router, "/pages"}, {AuthWeb.Router, "/auth"}],
|
||||||
email_from: "example@example.org"
|
email_from: "example@example.org"
|
||||||
|
|
||||||
config :content,
|
config :content_web,
|
||||||
generators: [context_app: false]
|
generators: [context_app: false]
|
||||||
|
|
||||||
config :content, Content.Endpoint, server: false
|
config :content_web, ContentWeb.Endpoint, server: false
|
||||||
config :auth_web, AuthWeb.Endpoint, server: false
|
config :auth_web, AuthWeb.Endpoint, server: false
|
||||||
|
|
||||||
import_config "../apps/*/config/config.exs"
|
import_config "../apps/*/config/config.exs"
|
||||||
|
|
|
@ -71,7 +71,7 @@ config :auth_web, AuthWeb.Endpoint,
|
||||||
# The watchers configuration can be used to run external
|
# The watchers configuration can be used to run external
|
||||||
# watchers to your application. For example, we use it
|
# watchers to your application. For example, we use it
|
||||||
# with webpack to recompile .js and .css sources.
|
# with webpack to recompile .js and .css sources.
|
||||||
config :content, Content.Endpoint,
|
config :content_web, ContentWeb.Endpoint,
|
||||||
http: [port: 4000],
|
http: [port: 4000],
|
||||||
debug_errors: true,
|
debug_errors: true,
|
||||||
code_reloader: true,
|
code_reloader: true,
|
||||||
|
@ -82,7 +82,7 @@ config :content, Content.Endpoint,
|
||||||
"--mode",
|
"--mode",
|
||||||
"development",
|
"development",
|
||||||
"--watch-stdin",
|
"--watch-stdin",
|
||||||
cd: Path.expand("../apps/content/assets", __DIR__)
|
cd: Path.expand("../apps/content_web/assets", __DIR__)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -111,13 +111,13 @@ config :content, Content.Endpoint,
|
||||||
# different ports.
|
# different ports.
|
||||||
|
|
||||||
# Watch static and templates for browser reloading.
|
# Watch static and templates for browser reloading.
|
||||||
config :content, Content.Endpoint,
|
config :content_web, ContentWeb.Endpoint,
|
||||||
live_reload: [
|
live_reload: [
|
||||||
patterns: [
|
patterns: [
|
||||||
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
||||||
~r"priv/gettext/.*(po)$",
|
~r"priv/gettext/.*(po)$",
|
||||||
~r"lib/content/(live|views)/.*(ex)$",
|
~r"lib/content_web/(live|views)/.*(ex)$",
|
||||||
~r"lib/content/templates/.*(eex)$"
|
~r"lib/content_web/templates/.*(eex)$"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ config :auth_web, AuthWeb.Endpoint,
|
||||||
# manifest is generated by the `mix phx.digest` task,
|
# manifest is generated by the `mix phx.digest` task,
|
||||||
# which you should run after static files are built and
|
# which you should run after static files are built and
|
||||||
# before starting your production server.
|
# before starting your production server.
|
||||||
config :content, Content.Endpoint,
|
config :content_web, ContentWeb.Endpoint,
|
||||||
url: [host: "example.com", port: 80],
|
url: [host: "example.com", port: 80],
|
||||||
cache_static_manifest: "priv/static/cache_manifest.json"
|
cache_static_manifest: "priv/static/cache_manifest.json"
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ config :content, Content.Endpoint,
|
||||||
# To get SSL working, you will need to add the `https` key
|
# To get SSL working, you will need to add the `https` key
|
||||||
# to the previous section and set your `:url` port to 443:
|
# to the previous section and set your `:url` port to 443:
|
||||||
#
|
#
|
||||||
# config :content, Content.Endpoint,
|
# config :content_web, ContentWeb.Endpoint,
|
||||||
# ...
|
# ...
|
||||||
# url: [host: "example.com", port: 443],
|
# url: [host: "example.com", port: 443],
|
||||||
# https: [
|
# https: [
|
||||||
|
@ -89,7 +89,7 @@ config :content, Content.Endpoint,
|
||||||
# We also recommend setting `force_ssl` in your endpoint, ensuring
|
# We also recommend setting `force_ssl` in your endpoint, ensuring
|
||||||
# no data is ever sent via http, always redirecting to https:
|
# no data is ever sent via http, always redirecting to https:
|
||||||
#
|
#
|
||||||
# config :content, Content.Endpoint,
|
# config :content_web, ContentWeb.Endpoint,
|
||||||
# force_ssl: [hsts: true]
|
# force_ssl: [hsts: true]
|
||||||
#
|
#
|
||||||
# Check `Plug.SSL` for all available options in `force_ssl`.
|
# Check `Plug.SSL` for all available options in `force_ssl`.
|
||||||
|
|
|
@ -21,6 +21,6 @@ config :auth_web, AuthWeb.Endpoint,
|
||||||
|
|
||||||
# We don't run a server during test. If one is required,
|
# We don't run a server during test. If one is required,
|
||||||
# you can enable the server option below.
|
# you can enable the server option below.
|
||||||
config :content, Content.Endpoint,
|
config :content_web, ContentWeb.Endpoint,
|
||||||
http: [port: 4002],
|
http: [port: 4002],
|
||||||
server: false
|
server: false
|
||||||
|
|
Loading…
Reference in a new issue