Rename module to `boardwise`.

pull/1/head
Joshua Potter 2023-11-30 10:25:00 -07:00
parent ba011253d8
commit 615509216a
40 changed files with 155 additions and 154 deletions

0
.githooks/pre-commit Executable file → Normal file
View File

2
.gitignore vendored
View File

@ -23,7 +23,7 @@ erl_crash.dump
/tmp/ /tmp/
# Ignore package tarball (built via "mix hex.build"). # Ignore package tarball (built via "mix hex.build").
site-*.tar boardwise-*.tar
# Ignore assets that are produced by build tools. # Ignore assets that are produced by build tools.
/priv/static/assets/ /priv/static/assets/

View File

@ -8,8 +8,8 @@ const path = require("path")
module.exports = { module.exports = {
content: [ content: [
"./js/**/*.js", "./js/**/*.js",
"../lib/site_web.ex", "../lib/boardwise_web.ex",
"../lib/site_web/**/*.*ex" "../lib/boardwise_web/**/*.*ex"
], ],
theme: { theme: {
extend: { extend: {

View File

@ -7,20 +7,21 @@
# General application configuration # General application configuration
import Config import Config
config :site, config :boardwise,
ecto_repos: [Site.Repo], namespace: BoardWise,
ecto_repos: [BoardWise.Repo],
generators: [timestamp_type: :utc_datetime] generators: [timestamp_type: :utc_datetime]
# Configures the endpoint # Configures the endpoint
config :site, SiteWeb.Endpoint, config :boardwise, BoardWiseWeb.Endpoint,
url: [host: "localhost"], url: [host: "localhost"],
adapter: Phoenix.Endpoint.Cowboy2Adapter, adapter: Phoenix.Endpoint.Cowboy2Adapter,
render_errors: [ render_errors: [
formats: [html: SiteWeb.ErrorHTML, json: SiteWeb.ErrorJSON], formats: [html: BoardWiseWeb.ErrorHTML, json: BoardWiseWeb.ErrorJSON],
layout: false layout: false
], ],
pubsub_server: Site.PubSub, pubsub_server: BoardWise.PubSub,
live_view: [signing_salt: "Wq4i8F/W"] live_view: [signing_salt: "NutZSMRk"]
# Configures the mailer # Configures the mailer
# #
@ -29,7 +30,7 @@ config :site, SiteWeb.Endpoint,
# #
# For production it's recommended to configure a different adapter # For production it's recommended to configure a different adapter
# at the `config/runtime.exs`. # at the `config/runtime.exs`.
config :site, Site.Mailer, adapter: Swoosh.Adapters.Local config :boardwise, BoardWise.Mailer, adapter: Swoosh.Adapters.Local
# Configure esbuild (the version is required) # Configure esbuild (the version is required)
config :esbuild, config :esbuild,

View File

@ -1,11 +1,11 @@
import Config import Config
# Configure your database # Configure your database
config :site, Site.Repo, config :boardwise, BoardWise.Repo,
username: "jrpotter", username: "jrpotter",
password: "postgres", password: "postgres",
hostname: "localhost", hostname: "localhost",
database: "site_dev", database: "boardwise_dev",
stacktrace: true, stacktrace: true,
show_sensitive_data_on_connection_error: true, show_sensitive_data_on_connection_error: true,
pool_size: 10 pool_size: 10
@ -16,14 +16,14 @@ config :site, Site.Repo,
# 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 can use it # watchers to your application. For example, we can use it
# to bundle .js and .css sources. # to bundle .js and .css sources.
config :site, SiteWeb.Endpoint, config :boardwise, BoardWiseWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines. # Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines. # Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {127, 0, 0, 1}, port: 4000], http: [ip: {127, 0, 0, 1}, port: 4000],
check_origin: false, check_origin: false,
code_reloader: true, code_reloader: true,
debug_errors: true, debug_errors: true,
secret_key_base: "9o2fhxlaKOfOintGZYpUTa4dSiJoPdFk09Yju0mRhfLWsLP26L9i57TBzpe61qcT", secret_key_base: "5hf4wAGNe1kUPI9qJ+YOA4+05hlFOY3QJRc0RqnXpt01XbR/e5ZCNQHIEO7TR9Uo",
watchers: [ watchers: [
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}, esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]} tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
@ -53,17 +53,17 @@ config :site, SiteWeb.Endpoint,
# different ports. # different ports.
# Watch static and templates for browser reloading. # Watch static and templates for browser reloading.
config :site, SiteWeb.Endpoint, config :boardwise, BoardWiseWeb.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/site_web/(controllers|live|components)/.*(ex|heex)$" ~r"lib/boardwise_web/(controllers|live|components)/.*(ex|heex)$"
] ]
] ]
# Enable dev routes for dashboard and mailbox # Enable dev routes for dashboard and mailbox
config :site, dev_routes: true config :boardwise, dev_routes: true
# Do not include metadata nor timestamps in development logs # Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n" config :logger, :console, format: "[$level] $message\n"

View File

@ -5,10 +5,10 @@ import Config
# manifest is generated by the `mix assets.deploy` task, # manifest is generated by the `mix assets.deploy` 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 :site, SiteWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json" config :boardwise, BoardWiseWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
# Configures Swoosh API Client # Configures Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Site.Finch config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: BoardWise.Finch
# Disable Swoosh Local Memory Storage # Disable Swoosh Local Memory Storage
config :swoosh, local: false config :swoosh, local: false

View File

@ -12,12 +12,12 @@ import Config
# If you use `mix release`, you need to explicitly enable the server # If you use `mix release`, you need to explicitly enable the server
# by passing the PHX_SERVER=true when you start it: # by passing the PHX_SERVER=true when you start it:
# #
# PHX_SERVER=true bin/site start # PHX_SERVER=true bin/boardwise start
# #
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server` # Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
# script that automatically sets the env var above. # script that automatically sets the env var above.
if System.get_env("PHX_SERVER") do if System.get_env("PHX_SERVER") do
config :site, SiteWeb.Endpoint, server: true config :boardwise, BoardWiseWeb.Endpoint, server: true
end end
if config_env() == :prod do if config_env() == :prod do
@ -30,7 +30,7 @@ if config_env() == :prod do
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: [] maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :site, Site.Repo, config :boardwise, BoardWise.Repo,
# ssl: true, # ssl: true,
url: database_url, url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
@ -51,9 +51,9 @@ if config_env() == :prod do
host = System.get_env("PHX_HOST") || "example.com" host = System.get_env("PHX_HOST") || "example.com"
port = String.to_integer(System.get_env("PORT") || "4000") port = String.to_integer(System.get_env("PORT") || "4000")
config :site, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY") config :boardwise, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
config :site, SiteWeb.Endpoint, config :boardwise, BoardWiseWeb.Endpoint,
url: [host: host, port: 443, scheme: "https"], url: [host: host, port: 443, scheme: "https"],
http: [ http: [
# Enable IPv6 and bind on all interfaces. # Enable IPv6 and bind on all interfaces.
@ -70,7 +70,7 @@ if config_env() == :prod do
# 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 your endpoint configuration: # to your endpoint configuration:
# #
# config :site, SiteWeb.Endpoint, # config :boardwise, BoardWiseWeb.Endpoint,
# https: [ # https: [
# ..., # ...,
# port: 443, # port: 443,
@ -92,7 +92,7 @@ if config_env() == :prod do
# 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 :site, SiteWeb.Endpoint, # config :boardwise, BoardWiseWeb.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`.
@ -103,7 +103,7 @@ if config_env() == :prod do
# Also, you may need to configure the Swoosh API client of your choice if you # Also, you may need to configure the Swoosh API client of your choice if you
# are not using SMTP. Here is an example of the configuration: # are not using SMTP. Here is an example of the configuration:
# #
# config :site, Site.Mailer, # config :boardwise, BoardWise.Mailer,
# adapter: Swoosh.Adapters.Mailgun, # adapter: Swoosh.Adapters.Mailgun,
# api_key: System.get_env("MAILGUN_API_KEY"), # api_key: System.get_env("MAILGUN_API_KEY"),
# domain: System.get_env("MAILGUN_DOMAIN") # domain: System.get_env("MAILGUN_DOMAIN")

View File

@ -5,23 +5,23 @@ import Config
# The MIX_TEST_PARTITION environment variable can be used # The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment. # to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information. # Run `mix help test` for more information.
config :site, Site.Repo, config :boardwise, BoardWise.Repo,
username: "postgres", username: "postgres",
password: "postgres", password: "postgres",
hostname: "localhost", hostname: "localhost",
database: "site_test#{System.get_env("MIX_TEST_PARTITION")}", database: "boardwise_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox, pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10 pool_size: 10
# 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 :site, SiteWeb.Endpoint, config :boardwise, BoardWiseWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 4002], http: [ip: {127, 0, 0, 1}, port: 4002],
secret_key_base: "T0jFDk3PWnwZCoYdv8l2ZgOk8thliSovjN++aOs6DWMKb7RP6dN+VNR7Ptnja1RW", secret_key_base: "0Nt/alF0NScLRGMz58M9EOaiFrzuQjeMgwTo4QsBpqkJeRMw1MQvG0OIIgTZVEmF",
server: false server: false
# In test we don't send emails. # In test we don't send emails.
config :site, Site.Mailer, adapter: Swoosh.Adapters.Test config :boardwise, BoardWise.Mailer, adapter: Swoosh.Adapters.Test
# Disable swoosh api client as it is only required for production adapters. # Disable swoosh api client as it is only required for production adapters.
config :swoosh, :api_client, false config :swoosh, :api_client, false

View File

@ -32,7 +32,7 @@
{ {
packages = { packages = {
app = mixRelease { app = mixRelease {
pname = "site"; pname = "boardwise";
src = ./.; src = ./.;
version = "0.1.0"; version = "0.1.0";
mixNixDeps = deps; mixNixDeps = deps;

View File

@ -1,6 +1,6 @@
defmodule Site do defmodule BoardWise do
@moduledoc """ @moduledoc """
Site keeps the contexts that define your domain BoardWise keeps the contexts that define your domain
and business logic. and business logic.
Contexts are also responsible for managing your data, regardless Contexts are also responsible for managing your data, regardless

View File

@ -1,4 +1,4 @@
defmodule Site.Application do defmodule BoardWise.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,21 +8,21 @@ defmodule Site.Application do
@impl true @impl true
def start(_type, _args) do def start(_type, _args) do
children = [ children = [
SiteWeb.Telemetry, BoardWiseWeb.Telemetry,
Site.Repo, BoardWise.Repo,
{DNSCluster, query: Application.get_env(:site, :dns_cluster_query) || :ignore}, {DNSCluster, query: Application.get_env(:boardwise, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: Site.PubSub}, {Phoenix.PubSub, name: BoardWise.PubSub},
# Start the Finch HTTP client for sending emails # Start the Finch HTTP client for sending emails
{Finch, name: Site.Finch}, {Finch, name: BoardWise.Finch},
# Start a worker by calling: Site.Worker.start_link(arg) # Start a worker by calling: BoardWise.Worker.start_link(arg)
# {Site.Worker, arg}, # {BoardWise.Worker, arg},
# Start to serve requests, typically the last entry # Start to serve requests, typically the last entry
SiteWeb.Endpoint BoardWiseWeb.Endpoint
] ]
# 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: Site.Supervisor] opts = [strategy: :one_for_one, name: BoardWise.Supervisor]
Supervisor.start_link(children, opts) Supervisor.start_link(children, opts)
end end
@ -30,7 +30,7 @@ defmodule Site.Application do
# whenever the application is updated. # whenever the application is updated.
@impl true @impl true
def config_change(changed, _new, removed) do def config_change(changed, _new, removed) do
SiteWeb.Endpoint.config_change(changed, removed) BoardWiseWeb.Endpoint.config_change(changed, removed)
:ok :ok
end end
end end

3
lib/boardwise/mailer.ex Normal file
View File

@ -0,0 +1,3 @@
defmodule BoardWise.Mailer do
use Swoosh.Mailer, otp_app: :boardwise
end

View File

@ -1,5 +1,5 @@
defmodule Site.Repo do defmodule BoardWise.Repo do
use Ecto.Repo, use Ecto.Repo,
otp_app: :site, otp_app: :boardwise,
adapter: Ecto.Adapters.Postgres adapter: Ecto.Adapters.Postgres
end end

View File

@ -1,12 +1,12 @@
defmodule SiteWeb do defmodule BoardWiseWeb do
@moduledoc """ @moduledoc """
The entrypoint for defining your web interface, such The entrypoint for defining your web interface, such
as controllers, components, channels, and so on. as controllers, components, channels, and so on.
This can be used in your application as: This can be used in your application as:
use SiteWeb, :controller use BoardWiseWeb, :controller
use SiteWeb, :html use BoardWiseWeb, :html
The definitions below will be executed for every controller, The definitions below will be executed for every controller,
component, etc, so keep them short and clean, focused component, etc, so keep them short and clean, focused
@ -40,10 +40,10 @@ defmodule SiteWeb do
quote do quote do
use Phoenix.Controller, use Phoenix.Controller,
formats: [:html, :json], formats: [:html, :json],
layouts: [html: SiteWeb.Layouts] layouts: [html: BoardWiseWeb.Layouts]
import Plug.Conn import Plug.Conn
import SiteWeb.Gettext import BoardWiseWeb.Gettext
unquote(verified_routes()) unquote(verified_routes())
end end
@ -52,7 +52,7 @@ defmodule SiteWeb do
def live_view do def live_view do
quote do quote do
use Phoenix.LiveView, use Phoenix.LiveView,
layout: {SiteWeb.Layouts, :app} layout: {BoardWiseWeb.Layouts, :app}
unquote(html_helpers()) unquote(html_helpers())
end end
@ -84,8 +84,8 @@ defmodule SiteWeb do
# HTML escaping functionality # HTML escaping functionality
import Phoenix.HTML import Phoenix.HTML
# Core UI components and translation # Core UI components and translation
import SiteWeb.CoreComponents import BoardWiseWeb.CoreComponents
import SiteWeb.Gettext import BoardWiseWeb.Gettext
# Shortcut for generating JS commands # Shortcut for generating JS commands
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS
@ -98,9 +98,9 @@ defmodule SiteWeb do
def verified_routes do def verified_routes do
quote do quote do
use Phoenix.VerifiedRoutes, use Phoenix.VerifiedRoutes,
endpoint: SiteWeb.Endpoint, endpoint: BoardWiseWeb.Endpoint,
router: SiteWeb.Router, router: BoardWiseWeb.Router,
statics: SiteWeb.static_paths() statics: BoardWiseWeb.static_paths()
end end
end end

View File

@ -1,4 +1,4 @@
defmodule SiteWeb.CoreComponents do defmodule BoardWiseWeb.CoreComponents do
@moduledoc """ @moduledoc """
Provides core UI components. Provides core UI components.
@ -17,7 +17,7 @@ defmodule SiteWeb.CoreComponents do
use Phoenix.Component use Phoenix.Component
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS
import SiteWeb.Gettext import BoardWiseWeb.Gettext
@doc """ @doc """
Renders a modal. Renders a modal.
@ -659,9 +659,9 @@ defmodule SiteWeb.CoreComponents do
# with our gettext backend as first argument. Translations are # with our gettext backend as first argument. Translations are
# available in the errors.po file (as we use the "errors" domain). # available in the errors.po file (as we use the "errors" domain).
if count = opts[:count] do if count = opts[:count] do
Gettext.dngettext(SiteWeb.Gettext, "errors", msg, msg, count, opts) Gettext.dngettext(BoardWiseWeb.Gettext, "errors", msg, msg, count, opts)
else else
Gettext.dgettext(SiteWeb.Gettext, "errors", msg, opts) Gettext.dgettext(BoardWiseWeb.Gettext, "errors", msg, opts)
end end
end end

View File

@ -0,0 +1,5 @@
defmodule BoardWiseWeb.Layouts do
use BoardWiseWeb, :html
embed_templates "layouts/*"
end

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} /> <meta name="csrf-token" content={get_csrf_token()} />
<.live_title suffix=" · Phoenix Framework"> <.live_title suffix=" · Phoenix Framework">
<%= assigns[:page_title] || "Site" %> <%= assigns[:page_title] || "BoardWise" %>
</.live_title> </.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} /> <link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}> <script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>

View File

@ -1,12 +1,12 @@
defmodule SiteWeb.ErrorHTML do defmodule BoardWiseWeb.ErrorHTML do
use SiteWeb, :html use BoardWiseWeb, :html
# If you want to customize your error pages, # If you want to customize your error pages,
# uncomment the embed_templates/1 call below # uncomment the embed_templates/1 call below
# and add pages to the error directory: # and add pages to the error directory:
# #
# * lib/site_web/controllers/error_html/404.html.heex # * lib/boardwise_web/controllers/error_html/404.html.heex
# * lib/site_web/controllers/error_html/500.html.heex # * lib/boardwise_web/controllers/error_html/500.html.heex
# #
# embed_templates "error_html/*" # embed_templates "error_html/*"

View File

@ -1,4 +1,4 @@
defmodule SiteWeb.ErrorJSON do defmodule BoardWiseWeb.ErrorJSON do
# If you want to customize a particular status code, # If you want to customize a particular status code,
# you may add your own clauses, such as: # you may add your own clauses, such as:
# #

View File

@ -1,5 +1,5 @@
defmodule SiteWeb.PageController do defmodule BoardWiseWeb.PageController do
use SiteWeb, :controller use BoardWiseWeb, :controller
def home(conn, _params) do def home(conn, _params) do
# The home page is often custom made, # The home page is often custom made,

View File

@ -0,0 +1,5 @@
defmodule BoardWiseWeb.PageHTML do
use BoardWiseWeb, :html
embed_templates "page_html/*"
end

View File

@ -1,13 +1,13 @@
defmodule SiteWeb.Endpoint do defmodule BoardWiseWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :site use Phoenix.Endpoint, otp_app: :boardwise
# 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.
# Set :encryption_salt if you would also like to encrypt it. # Set :encryption_salt if you would also like to encrypt it.
@session_options [ @session_options [
store: :cookie, store: :cookie,
key: "_site_key", key: "_boardwise_key",
signing_salt: "ywosTGeI", signing_salt: "YH8oartu",
same_site: "Lax" same_site: "Lax"
] ]
@ -19,9 +19,9 @@ defmodule SiteWeb.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: :site, from: :boardwise,
gzip: false, gzip: false,
only: SiteWeb.static_paths() only: BoardWiseWeb.static_paths()
# Code reloading can be explicitly enabled under the # Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint. # :code_reloader configuration of your endpoint.
@ -29,7 +29,7 @@ defmodule SiteWeb.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: :site plug Phoenix.Ecto.CheckRepoStatus, otp_app: :boardwise
end end
plug Phoenix.LiveDashboard.RequestLogger, plug Phoenix.LiveDashboard.RequestLogger,
@ -47,5 +47,5 @@ defmodule SiteWeb.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 SiteWeb.Router plug BoardWiseWeb.Router
end end

View File

@ -1,11 +1,11 @@
defmodule SiteWeb.Gettext do defmodule BoardWiseWeb.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 SiteWeb.Gettext import BoardWiseWeb.Gettext
# Simple translation # Simple translation
gettext("Here is the string to translate") gettext("Here is the string to translate")
@ -20,5 +20,5 @@ defmodule SiteWeb.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: :site use Gettext, otp_app: :boardwise
end end

View File

@ -1,11 +1,11 @@
defmodule SiteWeb.Router do defmodule BoardWiseWeb.Router do
use SiteWeb, :router use BoardWiseWeb, :router
pipeline :browser do pipeline :browser do
plug :accepts, ["html"] plug :accepts, ["html"]
plug :fetch_session plug :fetch_session
plug :fetch_live_flash plug :fetch_live_flash
plug :put_root_layout, html: {SiteWeb.Layouts, :root} plug :put_root_layout, html: {BoardWiseWeb.Layouts, :root}
plug :protect_from_forgery plug :protect_from_forgery
plug :put_secure_browser_headers plug :put_secure_browser_headers
end end
@ -14,19 +14,19 @@ defmodule SiteWeb.Router do
plug :accepts, ["json"] plug :accepts, ["json"]
end end
scope "/", SiteWeb do scope "/", BoardWiseWeb do
pipe_through :browser pipe_through :browser
get "/", PageController, :home get "/", PageController, :home
end end
# Other scopes may use custom stacks. # Other scopes may use custom stacks.
# scope "/api", SiteWeb do # scope "/api", BoardWiseWeb do
# pipe_through :api # pipe_through :api
# end # end
# Enable LiveDashboard and Swoosh mailbox preview in development # Enable LiveDashboard and Swoosh mailbox preview in development
if Application.compile_env(:site, :dev_routes) do if Application.compile_env(:boardwise, :dev_routes) do
# If you want to use the LiveDashboard in production, you should put # If you want to use the LiveDashboard in production, you should put
# it behind authentication and allow only admins to access it. # it behind authentication and allow only admins to access it.
# If your application does not have an admins-only section yet, # If your application does not have an admins-only section yet,
@ -37,7 +37,7 @@ defmodule SiteWeb.Router do
scope "/dev" do scope "/dev" do
pipe_through :browser pipe_through :browser
live_dashboard "/dashboard", metrics: SiteWeb.Telemetry live_dashboard "/dashboard", metrics: BoardWiseWeb.Telemetry
forward "/mailbox", Plug.Swoosh.MailboxPreview forward "/mailbox", Plug.Swoosh.MailboxPreview
end end
end end

View File

@ -1,4 +1,4 @@
defmodule SiteWeb.Telemetry do defmodule BoardWiseWeb.Telemetry do
use Supervisor use Supervisor
import Telemetry.Metrics import Telemetry.Metrics
@ -52,23 +52,23 @@ defmodule SiteWeb.Telemetry do
), ),
# Database Metrics # Database Metrics
summary("site.repo.query.total_time", summary("boardwise.repo.query.total_time",
unit: {:native, :millisecond}, unit: {:native, :millisecond},
description: "The sum of the other measurements" description: "The sum of the other measurements"
), ),
summary("site.repo.query.decode_time", summary("boardwise.repo.query.decode_time",
unit: {:native, :millisecond}, unit: {:native, :millisecond},
description: "The time spent decoding the data received from the database" description: "The time spent decoding the data received from the database"
), ),
summary("site.repo.query.query_time", summary("boardwise.repo.query.query_time",
unit: {:native, :millisecond}, unit: {:native, :millisecond},
description: "The time spent executing the query" description: "The time spent executing the query"
), ),
summary("site.repo.query.queue_time", summary("boardwise.repo.query.queue_time",
unit: {:native, :millisecond}, unit: {:native, :millisecond},
description: "The time spent waiting for a database connection" description: "The time spent waiting for a database connection"
), ),
summary("site.repo.query.idle_time", summary("boardwise.repo.query.idle_time",
unit: {:native, :millisecond}, unit: {:native, :millisecond},
description: description:
"The time the connection spent waiting before being checked out for the query" "The time the connection spent waiting before being checked out for the query"
@ -86,7 +86,7 @@ defmodule SiteWeb.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.
# {SiteWeb, :count_users, []} # {BoardWiseWeb, :count_users, []}
] ]
end end
end end

View File

@ -1,3 +0,0 @@
defmodule Site.Mailer do
use Swoosh.Mailer, otp_app: :site
end

View File

@ -1,5 +0,0 @@
defmodule SiteWeb.Layouts do
use SiteWeb, :html
embed_templates "layouts/*"
end

View File

@ -1,5 +0,0 @@
defmodule SiteWeb.PageHTML do
use SiteWeb, :html
embed_templates "page_html/*"
end

View File

@ -1,9 +1,9 @@
defmodule Site.MixProject do defmodule BoardWise.MixProject do
use Mix.Project use Mix.Project
def project do def project do
[ [
app: :site, app: :boardwise,
version: "0.1.0", version: "0.1.0",
elixir: "~> 1.14", elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
@ -18,7 +18,7 @@ defmodule Site.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: {Site.Application, []}, mod: {BoardWise.Application, []},
extra_applications: [:logger, :runtime_tools] extra_applications: [:logger, :runtime_tools]
] ]
end end

View File

@ -5,7 +5,7 @@
# Inside the script, you can read and write to any of your # Inside the script, you can read and write to any of your
# repositories directly: # repositories directly:
# #
# Site.Repo.insert!(%Site.SomeSchema{}) # BoardWise.Repo.insert!(%BoardWise.SomeSchema{})
# #
# We recommend using the bang functions (`insert!`, `update!` # We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong. # and so on) as they will fail if something goes wrong.

View File

@ -0,0 +1,14 @@
defmodule BoardWiseWeb.ErrorHTMLTest do
use BoardWiseWeb.ConnCase, async: true
# Bring render_to_string/4 for testing custom views
import Phoenix.Template
test "renders 404.html" do
assert render_to_string(BoardWiseWeb.ErrorHTML, "404", "html", []) == "Not Found"
end
test "renders 500.html" do
assert render_to_string(BoardWiseWeb.ErrorHTML, "500", "html", []) == "Internal Server Error"
end
end

View File

@ -0,0 +1,12 @@
defmodule BoardWiseWeb.ErrorJSONTest do
use BoardWiseWeb.ConnCase, async: true
test "renders 404" do
assert BoardWiseWeb.ErrorJSON.render("404.json", %{}) == %{errors: %{detail: "Not Found"}}
end
test "renders 500" do
assert BoardWiseWeb.ErrorJSON.render("500.json", %{}) ==
%{errors: %{detail: "Internal Server Error"}}
end
end

View File

@ -1,5 +1,5 @@
defmodule SiteWeb.PageControllerTest do defmodule BoardWiseWeb.PageControllerTest do
use SiteWeb.ConnCase use BoardWiseWeb.ConnCase
test "GET /", %{conn: conn} do test "GET /", %{conn: conn} do
conn = get(conn, ~p"/") conn = get(conn, ~p"/")

View File

@ -1,14 +0,0 @@
defmodule SiteWeb.ErrorHTMLTest do
use SiteWeb.ConnCase, async: true
# Bring render_to_string/4 for testing custom views
import Phoenix.Template
test "renders 404.html" do
assert render_to_string(SiteWeb.ErrorHTML, "404", "html", []) == "Not Found"
end
test "renders 500.html" do
assert render_to_string(SiteWeb.ErrorHTML, "500", "html", []) == "Internal Server Error"
end
end

View File

@ -1,12 +0,0 @@
defmodule SiteWeb.ErrorJSONTest do
use SiteWeb.ConnCase, async: true
test "renders 404" do
assert SiteWeb.ErrorJSON.render("404.json", %{}) == %{errors: %{detail: "Not Found"}}
end
test "renders 500" do
assert SiteWeb.ErrorJSON.render("500.json", %{}) ==
%{errors: %{detail: "Internal Server Error"}}
end
end

View File

@ -1,4 +1,4 @@
defmodule SiteWeb.ConnCase do defmodule BoardWiseWeb.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 SiteWeb.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 SiteWeb.ConnCase, async: true`, although by setting `use BoardWiseWeb.ConnCase, async: true`, although
this option is not recommended for other databases. this option is not recommended for other databases.
""" """
@ -20,19 +20,19 @@ defmodule SiteWeb.ConnCase do
using do using do
quote do quote do
# The default endpoint for testing # The default endpoint for testing
@endpoint SiteWeb.Endpoint @endpoint BoardWiseWeb.Endpoint
use SiteWeb, :verified_routes use BoardWiseWeb, :verified_routes
# 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 SiteWeb.ConnCase import BoardWiseWeb.ConnCase
end end
end end
setup tags do setup tags do
Site.DataCase.setup_sandbox(tags) BoardWise.DataCase.setup_sandbox(tags)
{:ok, conn: Phoenix.ConnTest.build_conn()} {:ok, conn: Phoenix.ConnTest.build_conn()}
end end
end end

View File

@ -1,4 +1,4 @@
defmodule Site.DataCase do defmodule BoardWise.DataCase do
@moduledoc """ @moduledoc """
This module defines the setup for tests requiring This module defines the setup for tests requiring
access to the application's data layer. access to the application's data layer.
@ -10,7 +10,7 @@ defmodule Site.DataCase 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 Site.DataCase, async: true`, although by setting `use BoardWise.DataCase, async: true`, although
this option is not recommended for other databases. this option is not recommended for other databases.
""" """
@ -18,17 +18,17 @@ defmodule Site.DataCase do
using do using do
quote do quote do
alias Site.Repo alias BoardWise.Repo
import Ecto import Ecto
import Ecto.Changeset import Ecto.Changeset
import Ecto.Query import Ecto.Query
import Site.DataCase import BoardWise.DataCase
end end
end end
setup tags do setup tags do
Site.DataCase.setup_sandbox(tags) BoardWise.DataCase.setup_sandbox(tags)
:ok :ok
end end
@ -36,7 +36,7 @@ defmodule Site.DataCase do
Sets up the sandbox based on the test tags. Sets up the sandbox based on the test tags.
""" """
def setup_sandbox(tags) do def setup_sandbox(tags) do
pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Site.Repo, shared: not tags[:async]) pid = Ecto.Adapters.SQL.Sandbox.start_owner!(BoardWise.Repo, shared: not tags[:async])
on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
end end

View File

@ -1,2 +1,2 @@
ExUnit.start() ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(Site.Repo, :manual) Ecto.Adapters.SQL.Sandbox.mode(BoardWise.Repo, :manual)