switch to sqlite, generate new project as 'quip'

This commit is contained in:
silentsilas 2024-09-02 19:47:01 -04:00
parent 3e77cb13b2
commit f5c2b7d67e
Signed by: silentsilas
GPG Key ID: 113DFB380F724A81
47 changed files with 220 additions and 231 deletions

6
.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").
phoenix_test-*.tar quip-*.tar
# Ignore assets that are produced by build tools. # Ignore assets that are produced by build tools.
/priv/static/assets/ /priv/static/assets/
@ -35,3 +35,7 @@ phoenix_test-*.tar
npm-debug.log npm-debug.log
/assets/node_modules/ /assets/node_modules/
# Database files
*.db
*.db-*

View File

@ -1,3 +0,0 @@
nodejs 20.17.0
erlang 27.0.1
elixir 1.17.2

View File

@ -21,7 +21,7 @@ ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
FROM ${BUILDER_IMAGE} as builder FROM ${BUILDER_IMAGE} as builder
# install build dependencies # install build dependencies
RUN apt-get update -y && apt-get install -y build-essential git curl \ RUN apt-get update -y && apt-get install -y build-essential git \
&& apt-get clean && rm -f /var/lib/apt/lists/*_* && apt-get clean && rm -f /var/lib/apt/lists/*_*
# prepare build dir # prepare build dir
@ -51,18 +51,6 @@ COPY lib lib
COPY assets assets COPY assets assets
ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION 20.9.0
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.39.5/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN mix cmd npm install --prefix assets
# compile assets # compile assets
RUN mix assets.deploy RUN mix assets.deploy
@ -97,7 +85,7 @@ RUN chown nobody /app
ENV MIX_ENV="prod" ENV MIX_ENV="prod"
# Only copy the final release from the build stage # Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/phoenix_test ./ COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/quip ./
USER nobody USER nobody

View File

@ -1,4 +1,4 @@
# PhoenixTest # Quip
To start your Phoenix server: To start your Phoenix server:

View File

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

View File

@ -7,20 +7,20 @@
# General application configuration # General application configuration
import Config import Config
config :phoenix_test, config :quip,
ecto_repos: [PhoenixTest.Repo], ecto_repos: [Quip.Repo],
generators: [timestamp_type: :utc_datetime] generators: [timestamp_type: :utc_datetime]
# Configures the endpoint # Configures the endpoint
config :phoenix_test, PhoenixTestWeb.Endpoint, config :quip, QuipWeb.Endpoint,
url: [host: "localhost"], url: [host: "localhost"],
adapter: Bandit.PhoenixAdapter, adapter: Bandit.PhoenixAdapter,
render_errors: [ render_errors: [
formats: [html: PhoenixTestWeb.ErrorHTML, json: PhoenixTestWeb.ErrorJSON], formats: [html: QuipWeb.ErrorHTML, json: QuipWeb.ErrorJSON],
layout: false layout: false
], ],
pubsub_server: PhoenixTest.PubSub, pubsub_server: Quip.PubSub,
live_view: [signing_salt: "bXtM8iJy"] live_view: [signing_salt: "J4MlrElx"]
# Configures the mailer # Configures the mailer
# #
@ -29,12 +29,12 @@ config :phoenix_test, PhoenixTestWeb.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 :phoenix_test, PhoenixTest.Mailer, adapter: Swoosh.Adapters.Local config :quip, Quip.Mailer, adapter: Swoosh.Adapters.Local
# Configure esbuild (the version is required) # Configure esbuild (the version is required)
config :esbuild, config :esbuild,
version: "0.17.11", version: "0.17.11",
phoenix_test: [ quip: [
args: args:
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*), ~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
cd: Path.expand("../assets", __DIR__), cd: Path.expand("../assets", __DIR__),
@ -44,7 +44,7 @@ config :esbuild,
# Configure tailwind (the version is required) # Configure tailwind (the version is required)
config :tailwind, config :tailwind,
version: "3.4.3", version: "3.4.3",
phoenix_test: [ quip: [
args: ~w( args: ~w(
--config=tailwind.config.js --config=tailwind.config.js
--input=css/app.css --input=css/app.css

View File

@ -1,14 +1,11 @@
import Config import Config
# Configure your database # Configure your database
config :phoenix_test, PhoenixTest.Repo, config :quip, Quip.Repo,
username: "postgres", database: Path.expand("../quip_dev.db", __DIR__),
password: "postgres", pool_size: 5,
hostname: "localhost",
database: "phoenix_test_dev",
stacktrace: true, stacktrace: true,
show_sensitive_data_on_connection_error: true, show_sensitive_data_on_connection_error: true
pool_size: 10
# For development, we disable any cache and enable # For development, we disable any cache and enable
# debugging and code reloading. # debugging and code reloading.
@ -16,17 +13,17 @@ config :phoenix_test, PhoenixTest.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 :phoenix_test, PhoenixTestWeb.Endpoint, config :quip, QuipWeb.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: "5AWJTTMb3iv5xM9DExujLeC74qMduXvRv7keyiKc7/kvPOAKCOHInuX0C2hdWHmq", secret_key_base: "l4+6blY1rcppRaUjqSzQBM2ZZBfVwIobcktDvsq1eYMd+sMjaRhY0uSdI2qDTUlL",
watchers: [ watchers: [
esbuild: {Esbuild, :install_and_run, [:phoenix_test, ~w(--sourcemap=inline --watch)]}, esbuild: {Esbuild, :install_and_run, [:quip, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:phoenix_test, ~w(--watch)]} tailwind: {Tailwind, :install_and_run, [:quip, ~w(--watch)]}
] ]
# ## SSL Support # ## SSL Support
@ -53,17 +50,17 @@ config :phoenix_test, PhoenixTestWeb.Endpoint,
# different ports. # different ports.
# Watch static and templates for browser reloading. # Watch static and templates for browser reloading.
config :phoenix_test, PhoenixTestWeb.Endpoint, config :quip, QuipWeb.Endpoint,
live_reload: [ live_reload: [
patterns: [ patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$", ~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$", ~r"priv/gettext/.*(po)$",
~r"lib/phoenix_test_web/(controllers|live|components)/.*(ex|heex)$" ~r"lib/quip_web/(controllers|live|components)/.*(ex|heex)$"
] ]
] ]
# Enable dev routes for dashboard and mailbox # Enable dev routes for dashboard and mailbox
config :phoenix_test, dev_routes: true config :quip, 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,11 +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 :phoenix_test, PhoenixTestWeb.Endpoint, config :quip, QuipWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
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: PhoenixTest.Finch config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Quip.Finch
# Disable Swoosh Local Memory Storage # Disable Swoosh Local Memory Storage
config :swoosh, local: false config :swoosh, local: false

View File

@ -12,29 +12,25 @@ 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/phoenix_test start # PHX_SERVER=true bin/quip 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 :phoenix_test, PhoenixTestWeb.Endpoint, server: true config :quip, QuipWeb.Endpoint, server: true
end end
if config_env() == :prod do if config_env() == :prod do
database_url = database_path =
System.get_env("DATABASE_URL") || System.get_env("DATABASE_PATH") ||
raise """ raise """
environment variable DATABASE_URL is missing. environment variable DATABASE_PATH is missing.
For example: ecto://USER:PASS@HOST/DATABASE For example: /etc/quip/quip.db
""" """
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: [] config :quip, Quip.Repo,
database: database_path,
config :phoenix_test, PhoenixTest.Repo, pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
# The secret key base is used to sign/encrypt cookies and other secrets. # The secret key base is used to sign/encrypt cookies and other secrets.
# A default value is used in config/dev.exs and config/test.exs but you # A default value is used in config/dev.exs and config/test.exs but you
@ -51,9 +47,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 :phoenix_test, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY") config :quip, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
config :phoenix_test, PhoenixTestWeb.Endpoint, config :quip, QuipWeb.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 +66,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 :phoenix_test, PhoenixTestWeb.Endpoint, # config :quip, QuipWeb.Endpoint,
# https: [ # https: [
# ..., # ...,
# port: 443, # port: 443,
@ -92,7 +88,7 @@ if config_env() == :prod do
# We also recommend setting `force_ssl` in your config/prod.exs, # We also recommend setting `force_ssl` in your config/prod.exs,
# ensuring no data is ever sent via http, always redirecting to https: # ensuring no data is ever sent via http, always redirecting to https:
# #
# config :phoenix_test, PhoenixTestWeb.Endpoint, # config :quip, QuipWeb.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 +99,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 :phoenix_test, PhoenixTest.Mailer, # config :quip, Quip.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,20 @@ 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 :phoenix_test, PhoenixTest.Repo, config :quip, Quip.Repo,
username: "postgres", database: Path.expand("../quip_test.db", __DIR__),
password: "postgres", pool_size: 5,
hostname: "localhost", pool: Ecto.Adapters.SQL.Sandbox
database: "phoenix_test_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: System.schedulers_online() * 2
# 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 :phoenix_test, PhoenixTestWeb.Endpoint, config :quip, QuipWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 4002], http: [ip: {127, 0, 0, 1}, port: 4002],
secret_key_base: "A7xacZJjAytqd85J4lTTrhOD2hD3rZE+DjLf4HVaxrOJB7M3ZvVx8v4erjVvJIER", secret_key_base: "60BPpQ3VaiaNWaJ9XBOpjteaYhP64maXILhzQMGiHqo6LOen7RfQrtBJ09ltCxLY",
server: false server: false
# In test we don't send emails # In test we don't send emails
config :phoenix_test, PhoenixTest.Mailer, adapter: Swoosh.Adapters.Test config :quip, Quip.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

@ -1,36 +0,0 @@
defmodule PhoenixTest.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
PhoenixTestWeb.Telemetry,
PhoenixTest.Repo,
{DNSCluster, query: Application.get_env(:phoenix_test, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: PhoenixTest.PubSub},
# Start the Finch HTTP client for sending emails
{Finch, name: PhoenixTest.Finch},
# Start a worker by calling: PhoenixTest.Worker.start_link(arg)
# {PhoenixTest.Worker, arg},
# Start to serve requests, typically the last entry
PhoenixTestWeb.Endpoint
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: PhoenixTest.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
@impl true
def config_change(changed, _new, removed) do
PhoenixTestWeb.Endpoint.config_change(changed, removed)
:ok
end
end

View File

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

View File

@ -1,5 +0,0 @@
defmodule PhoenixTest.Repo do
use Ecto.Repo,
otp_app: :phoenix_test,
adapter: Ecto.Adapters.Postgres
end

View File

@ -1,6 +1,6 @@
defmodule PhoenixTest do defmodule Quip do
@moduledoc """ @moduledoc """
PhoenixTest keeps the contexts that define your domain Quip 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

44
lib/quip/application.ex Normal file
View File

@ -0,0 +1,44 @@
defmodule Quip.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
QuipWeb.Telemetry,
Quip.Repo,
{Ecto.Migrator,
repos: Application.fetch_env!(:quip, :ecto_repos),
skip: skip_migrations?()},
{DNSCluster, query: Application.get_env(:quip, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: Quip.PubSub},
# Start the Finch HTTP client for sending emails
{Finch, name: Quip.Finch},
# Start a worker by calling: Quip.Worker.start_link(arg)
# {Quip.Worker, arg},
# Start to serve requests, typically the last entry
QuipWeb.Endpoint
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Quip.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
@impl true
def config_change(changed, _new, removed) do
QuipWeb.Endpoint.config_change(changed, removed)
:ok
end
defp skip_migrations?() do
# By default, sqlite migrations are run when using a release
System.get_env("RELEASE_NAME") != nil
end
end

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

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

View File

@ -1,9 +1,9 @@
defmodule PhoenixTest.Release do defmodule Quip.Release do
@moduledoc """ @moduledoc """
Used for executing DB release tasks when run in production without Mix Used for executing DB release tasks when run in production without Mix
installed. installed.
""" """
@app :phoenix_test @app :quip
def migrate do def migrate do
load_app() load_app()

5
lib/quip/repo.ex Normal file
View File

@ -0,0 +1,5 @@
defmodule Quip.Repo do
use Ecto.Repo,
otp_app: :quip,
adapter: Ecto.Adapters.SQLite3
end

View File

@ -1,12 +1,12 @@
defmodule PhoenixTestWeb do defmodule QuipWeb 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 PhoenixTestWeb, :controller use QuipWeb, :controller
use PhoenixTestWeb, :html use QuipWeb, :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 PhoenixTestWeb do
quote do quote do
use Phoenix.Controller, use Phoenix.Controller,
formats: [:html, :json], formats: [:html, :json],
layouts: [html: PhoenixTestWeb.Layouts] layouts: [html: QuipWeb.Layouts]
import Plug.Conn import Plug.Conn
import PhoenixTestWeb.Gettext import QuipWeb.Gettext
unquote(verified_routes()) unquote(verified_routes())
end end
@ -52,7 +52,7 @@ defmodule PhoenixTestWeb do
def live_view do def live_view do
quote do quote do
use Phoenix.LiveView, use Phoenix.LiveView,
layout: {PhoenixTestWeb.Layouts, :app} layout: {QuipWeb.Layouts, :app}
unquote(html_helpers()) unquote(html_helpers())
end end
@ -84,8 +84,8 @@ defmodule PhoenixTestWeb do
# HTML escaping functionality # HTML escaping functionality
import Phoenix.HTML import Phoenix.HTML
# Core UI components and translation # Core UI components and translation
import PhoenixTestWeb.CoreComponents import QuipWeb.CoreComponents
import PhoenixTestWeb.Gettext import QuipWeb.Gettext
# Shortcut for generating JS commands # Shortcut for generating JS commands
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS
@ -98,9 +98,9 @@ defmodule PhoenixTestWeb do
def verified_routes do def verified_routes do
quote do quote do
use Phoenix.VerifiedRoutes, use Phoenix.VerifiedRoutes,
endpoint: PhoenixTestWeb.Endpoint, endpoint: QuipWeb.Endpoint,
router: PhoenixTestWeb.Router, router: QuipWeb.Router,
statics: PhoenixTestWeb.static_paths() statics: QuipWeb.static_paths()
end end
end end

View File

@ -1,4 +1,4 @@
defmodule PhoenixTestWeb.CoreComponents do defmodule QuipWeb.CoreComponents do
@moduledoc """ @moduledoc """
Provides core UI components. Provides core UI components.
@ -17,7 +17,7 @@ defmodule PhoenixTestWeb.CoreComponents do
use Phoenix.Component use Phoenix.Component
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS
import PhoenixTestWeb.Gettext import QuipWeb.Gettext
@doc """ @doc """
Renders a modal. Renders a modal.
@ -661,9 +661,9 @@ defmodule PhoenixTestWeb.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(PhoenixTestWeb.Gettext, "errors", msg, msg, count, opts) Gettext.dngettext(QuipWeb.Gettext, "errors", msg, msg, count, opts)
else else
Gettext.dgettext(PhoenixTestWeb.Gettext, "errors", msg, opts) Gettext.dgettext(QuipWeb.Gettext, "errors", msg, opts)
end end
end end

View File

@ -1,14 +1,14 @@
defmodule PhoenixTestWeb.Layouts do defmodule QuipWeb.Layouts do
@moduledoc """ @moduledoc """
This module holds different layouts used by your application. This module holds different layouts used by your application.
See the `layouts` directory for all templates available. See the `layouts` directory for all templates available.
The "root" layout is a skeleton rendered as part of the The "root" layout is a skeleton rendered as part of the
application router. The "app" layout is set as the default application router. The "app" layout is set as the default
layout on both `use PhoenixTestWeb, :controller` and layout on both `use QuipWeb, :controller` and
`use PhoenixTestWeb, :live_view`. `use QuipWeb, :live_view`.
""" """
use PhoenixTestWeb, :html use QuipWeb, :html
embed_templates "layouts/*" embed_templates "layouts/*"
end 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] || "PhoenixTest" %> <%= assigns[:page_title] || "Quip" %>
</.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,17 +1,17 @@
defmodule PhoenixTestWeb.ErrorHTML do defmodule QuipWeb.ErrorHTML do
@moduledoc """ @moduledoc """
This module is invoked by your endpoint in case of errors on HTML requests. This module is invoked by your endpoint in case of errors on HTML requests.
See config/config.exs. See config/config.exs.
""" """
use PhoenixTestWeb, :html use QuipWeb, :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/phoenix_test_web/controllers/error_html/404.html.heex # * lib/quip_web/controllers/error_html/404.html.heex
# * lib/phoenix_test_web/controllers/error_html/500.html.heex # * lib/quip_web/controllers/error_html/500.html.heex
# #
# embed_templates "error_html/*" # embed_templates "error_html/*"

View File

@ -1,4 +1,4 @@
defmodule PhoenixTestWeb.ErrorJSON do defmodule QuipWeb.ErrorJSON do
@moduledoc """ @moduledoc """
This module is invoked by your endpoint in case of errors on JSON requests. This module is invoked by your endpoint in case of errors on JSON requests.

View File

@ -1,5 +1,5 @@
defmodule PhoenixTestWeb.PageController do defmodule QuipWeb.PageController do
use PhoenixTestWeb, :controller use QuipWeb, :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

@ -1,10 +1,10 @@
defmodule PhoenixTestWeb.PageHTML do defmodule QuipWeb.PageHTML do
@moduledoc """ @moduledoc """
This module contains pages rendered by PageController. This module contains pages rendered by PageController.
See the `page_html` directory for all templates available. See the `page_html` directory for all templates available.
""" """
use PhoenixTestWeb, :html use QuipWeb, :html
embed_templates "page_html/*" embed_templates "page_html/*"
end end

View File

@ -1,13 +1,13 @@
defmodule PhoenixTestWeb.Endpoint do defmodule QuipWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :phoenix_test use Phoenix.Endpoint, otp_app: :quip
# 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: "_phoenix_test_key", key: "_quip_key",
signing_salt: "YJZpfzhw", signing_salt: "1JjSQfVH",
same_site: "Lax" same_site: "Lax"
] ]
@ -21,9 +21,9 @@ defmodule PhoenixTestWeb.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: :phoenix_test, from: :quip,
gzip: false, gzip: false,
only: PhoenixTestWeb.static_paths() only: QuipWeb.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.
@ -31,7 +31,7 @@ defmodule PhoenixTestWeb.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: :phoenix_test plug Phoenix.Ecto.CheckRepoStatus, otp_app: :quip
end end
plug Phoenix.LiveDashboard.RequestLogger, plug Phoenix.LiveDashboard.RequestLogger,
@ -49,5 +49,5 @@ defmodule PhoenixTestWeb.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 PhoenixTestWeb.Router plug QuipWeb.Router
end end

View File

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

View File

@ -1,11 +1,11 @@
defmodule PhoenixTestWeb.Router do defmodule QuipWeb.Router do
use PhoenixTestWeb, :router use QuipWeb, :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: {PhoenixTestWeb.Layouts, :root} plug :put_root_layout, html: {QuipWeb.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 PhoenixTestWeb.Router do
plug :accepts, ["json"] plug :accepts, ["json"]
end end
scope "/", PhoenixTestWeb do scope "/", QuipWeb 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", PhoenixTestWeb do # scope "/api", QuipWeb 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(:phoenix_test, :dev_routes) do if Application.compile_env(:quip, :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 PhoenixTestWeb.Router do
scope "/dev" do scope "/dev" do
pipe_through :browser pipe_through :browser
live_dashboard "/dashboard", metrics: PhoenixTestWeb.Telemetry live_dashboard "/dashboard", metrics: QuipWeb.Telemetry
forward "/mailbox", Plug.Swoosh.MailboxPreview forward "/mailbox", Plug.Swoosh.MailboxPreview
end end
end end

View File

@ -1,4 +1,4 @@
defmodule PhoenixTestWeb.Telemetry do defmodule QuipWeb.Telemetry do
use Supervisor use Supervisor
import Telemetry.Metrics import Telemetry.Metrics
@ -52,23 +52,23 @@ defmodule PhoenixTestWeb.Telemetry do
), ),
# Database Metrics # Database Metrics
summary("phoenix_test.repo.query.total_time", summary("quip.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("phoenix_test.repo.query.decode_time", summary("quip.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("phoenix_test.repo.query.query_time", summary("quip.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("phoenix_test.repo.query.queue_time", summary("quip.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("phoenix_test.repo.query.idle_time", summary("quip.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 PhoenixTestWeb.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.
# {PhoenixTestWeb, :count_users, []} # {QuipWeb, :count_users, []}
] ]
end end
end end

14
mix.exs
View File

@ -1,9 +1,9 @@
defmodule PhoenixTest.MixProject do defmodule Quip.MixProject do
use Mix.Project use Mix.Project
def project do def project do
[ [
app: :phoenix_test, app: :quip,
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 PhoenixTest.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: {PhoenixTest.Application, []}, mod: {Quip.Application, []},
extra_applications: [:logger, :runtime_tools] extra_applications: [:logger, :runtime_tools]
] ]
end end
@ -35,7 +35,7 @@ defmodule PhoenixTest.MixProject do
{:phoenix, "~> 1.7.14"}, {:phoenix, "~> 1.7.14"},
{:phoenix_ecto, "~> 4.5"}, {:phoenix_ecto, "~> 4.5"},
{:ecto_sql, "~> 3.10"}, {:ecto_sql, "~> 3.10"},
{:postgrex, ">= 0.0.0"}, {:ecto_sqlite3, ">= 0.0.0"},
{:phoenix_html, "~> 4.1"}, {:phoenix_html, "~> 4.1"},
{:phoenix_live_reload, "~> 1.2", only: :dev}, {:phoenix_live_reload, "~> 1.2", only: :dev},
# TODO bump on release to {:phoenix_live_view, "~> 1.0.0"}, # TODO bump on release to {:phoenix_live_view, "~> 1.0.0"},
@ -75,10 +75,10 @@ defmodule PhoenixTest.MixProject do
"ecto.reset": ["ecto.drop", "ecto.setup"], "ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"], test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
"assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"], "assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"],
"assets.build": ["tailwind phoenix_test", "esbuild phoenix_test"], "assets.build": ["tailwind quip", "esbuild quip"],
"assets.deploy": [ "assets.deploy": [
"tailwind phoenix_test --minify", "tailwind quip --minify",
"esbuild phoenix_test --minify", "esbuild quip --minify",
"phx.digest" "phx.digest"
] ]
] ]

View File

@ -1,13 +1,17 @@
%{ %{
"bandit": {:hex, :bandit, "1.5.7", "6856b1e1df4f2b0cb3df1377eab7891bec2da6a7fd69dc78594ad3e152363a50", [:mix], [{:hpax, "~> 1.0.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "f2dd92ae87d2cbea2fa9aa1652db157b6cba6c405cb44d4f6dd87abba41371cd"}, "bandit": {:hex, :bandit, "1.5.7", "6856b1e1df4f2b0cb3df1377eab7891bec2da6a7fd69dc78594ad3e152363a50", [:mix], [{:hpax, "~> 1.0.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "f2dd92ae87d2cbea2fa9aa1652db157b6cba6c405cb44d4f6dd87abba41371cd"},
"castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"}, "castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"},
"cc_precompiler": {:hex, :cc_precompiler, "0.1.10", "47c9c08d8869cf09b41da36538f62bc1abd3e19e41701c2cea2675b53c704258", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f6e046254e53cd6b41c6bacd70ae728011aa82b2742a80d6e2214855c6e06b22"},
"db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dcf08f31b2701f857dfc787fbad78223d61a32204f217f15e881dd93e4bdd3ff"}, "db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dcf08f31b2701f857dfc787fbad78223d61a32204f217f15e881dd93e4bdd3ff"},
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
"dns_cluster": {:hex, :dns_cluster, "0.1.3", "0bc20a2c88ed6cc494f2964075c359f8c2d00e1bf25518a6a6c7fd277c9b0c66", [:mix], [], "hexpm", "46cb7c4a1b3e52c7ad4cbe33ca5079fbde4840dedeafca2baf77996c2da1bc33"}, "dns_cluster": {:hex, :dns_cluster, "0.1.3", "0bc20a2c88ed6cc494f2964075c359f8c2d00e1bf25518a6a6c7fd277c9b0c66", [:mix], [], "hexpm", "46cb7c4a1b3e52c7ad4cbe33ca5079fbde4840dedeafca2baf77996c2da1bc33"},
"ecto": {:hex, :ecto, "3.12.2", "bae2094f038e9664ce5f089e5f3b6132a535d8b018bd280a485c2f33df5c0ce1", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "492e67c70f3a71c6afe80d946d3ced52ecc57c53c9829791bfff1830ff5a1f0c"}, "ecto": {:hex, :ecto, "3.12.2", "bae2094f038e9664ce5f089e5f3b6132a535d8b018bd280a485c2f33df5c0ce1", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "492e67c70f3a71c6afe80d946d3ced52ecc57c53c9829791bfff1830ff5a1f0c"},
"ecto_sql": {:hex, :ecto_sql, "3.12.0", "73cea17edfa54bde76ee8561b30d29ea08f630959685006d9c6e7d1e59113b7d", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dc9e4d206f274f3947e96142a8fdc5f69a2a6a9abb4649ef5c882323b6d512f0"}, "ecto_sql": {:hex, :ecto_sql, "3.12.0", "73cea17edfa54bde76ee8561b30d29ea08f630959685006d9c6e7d1e59113b7d", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dc9e4d206f274f3947e96142a8fdc5f69a2a6a9abb4649ef5c882323b6d512f0"},
"ecto_sqlite3": {:hex, :ecto_sqlite3, "0.17.1", "96d08639aa1fb07a087daa2220ebc68d9f4f5dbb8aed930e771d848d8d472d32", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.12", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:exqlite, "~> 0.22", [hex: :exqlite, repo: "hexpm", optional: false]}], "hexpm", "dbd6a68b5364fe6e9ce5d70336709d62edaebbb4cb4acb5f13ec825f64fa48cc"},
"elixir_make": {:hex, :elixir_make, "0.8.4", "4960a03ce79081dee8fe119d80ad372c4e7badb84c493cc75983f9d3bc8bde0f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "6e7f1d619b5f61dfabd0a20aa268e575572b542ac31723293a4c1a567d5ef040"},
"esbuild": {:hex, :esbuild, "0.8.1", "0cbf919f0eccb136d2eeef0df49c4acf55336de864e63594adcea3814f3edf41", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "25fc876a67c13cb0a776e7b5d7974851556baeda2085296c14ab48555ea7560f"}, "esbuild": {:hex, :esbuild, "0.8.1", "0cbf919f0eccb136d2eeef0df49c4acf55336de864e63594adcea3814f3edf41", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "25fc876a67c13cb0a776e7b5d7974851556baeda2085296c14ab48555ea7560f"},
"expo": {:hex, :expo, "1.0.1", "f9e2f984f5b8d195815d52d0ba264798c12c8d2f2606f76fa4c60e8ebe39474d", [:mix], [], "hexpm", "f250b33274e3e56513644858c116f255d35c767c2b8e96a512fe7839ef9306a1"}, "expo": {:hex, :expo, "1.0.1", "f9e2f984f5b8d195815d52d0ba264798c12c8d2f2606f76fa4c60e8ebe39474d", [:mix], [], "hexpm", "f250b33274e3e56513644858c116f255d35c767c2b8e96a512fe7839ef9306a1"},
"exqlite": {:hex, :exqlite, "0.23.0", "6e851c937a033299d0784994c66da24845415072adbc455a337e20087bce9033", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.8", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "404341cceec5e6466aaed160cf0b58be2019b60af82588c215e1224ebd3ec831"},
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"}, "file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
"finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"}, "finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"},
"floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"}, "floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"},
@ -29,7 +33,6 @@
"phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"},
"plug": {:hex, :plug, "1.16.1", "40c74619c12f82736d2214557dedec2e9762029b2438d6d175c5074c933edc9d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a13ff6b9006b03d7e33874945b2755253841b238c34071ed85b0e86057f8cddc"}, "plug": {:hex, :plug, "1.16.1", "40c74619c12f82736d2214557dedec2e9762029b2438d6d175c5074c933edc9d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a13ff6b9006b03d7e33874945b2755253841b238c34071ed85b0e86057f8cddc"},
"plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"}, "plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"},
"postgrex": {:hex, :postgrex, "0.19.1", "73b498508b69aded53907fe48a1fee811be34cc720e69ef4ccd568c8715495ea", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "8bac7885a18f381e091ec6caf41bda7bb8c77912bb0e9285212829afe5d8a8f8"},
"swoosh": {:hex, :swoosh, "1.16.12", "cbb24ad512f2f7f24c7a469661c188a00a8c2cd64e0ab54acd1520f132092dfd", [:mix], [{:bandit, ">= 1.0.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mua, "~> 0.2.3", [hex: :mua, repo: "hexpm", optional: true]}, {:multipart, "~> 0.4", [hex: :multipart, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:req, "~> 0.5 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0e262df1ae510d59eeaaa3db42189a2aa1b3746f73771eb2616fc3f7ee63cc20"}, "swoosh": {:hex, :swoosh, "1.16.12", "cbb24ad512f2f7f24c7a469661c188a00a8c2cd64e0ab54acd1520f132092dfd", [:mix], [{:bandit, ">= 1.0.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mua, "~> 0.2.3", [hex: :mua, repo: "hexpm", optional: true]}, {:multipart, "~> 0.4", [hex: :multipart, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:req, "~> 0.5 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0e262df1ae510d59eeaaa3db42189a2aa1b3746f73771eb2616fc3f7ee63cc20"},
"tailwind": {:hex, :tailwind, "0.2.3", "277f08145d407de49650d0a4685dc062174bdd1ae7731c5f1da86163a24dfcdb", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "8e45e7a34a676a7747d04f7913a96c770c85e6be810a1d7f91e713d3a3655b5d"}, "tailwind": {:hex, :tailwind, "0.2.3", "277f08145d407de49650d0a4685dc062174bdd1ae7731c5f1da86163a24dfcdb", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "8e45e7a34a676a7747d04f7913a96c770c85e6be810a1d7f91e713d3a3655b5d"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"}, "telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},

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:
# #
# PhoenixTest.Repo.insert!(%PhoenixTest.SomeSchema{}) # Quip.Repo.insert!(%Quip.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

@ -2,4 +2,4 @@
set -eu set -eu
cd -P -- "$(dirname -- "$0")" cd -P -- "$(dirname -- "$0")"
exec ./phoenix_test eval PhoenixTest.Release.migrate exec ./quip eval Quip.Release.migrate

View File

@ -1 +1 @@
call "%~dp0\phoenix_test" eval PhoenixTest.Release.migrate call "%~dp0\quip" eval Quip.Release.migrate

View File

@ -2,4 +2,4 @@
set -eu set -eu
cd -P -- "$(dirname -- "$0")" cd -P -- "$(dirname -- "$0")"
PHX_SERVER=true exec ./phoenix_test start PHX_SERVER=true exec ./quip start

View File

@ -1,2 +1,2 @@
set PHX_SERVER=true set PHX_SERVER=true
call "%~dp0\phoenix_test" start call "%~dp0\quip" start

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
defmodule PhoenixTestWeb.ConnCase do defmodule QuipWeb.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 PhoenixTestWeb.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 PhoenixTestWeb.ConnCase, async: true`, although by setting `use QuipWeb.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 PhoenixTestWeb.ConnCase do
using do using do
quote do quote do
# The default endpoint for testing # The default endpoint for testing
@endpoint PhoenixTestWeb.Endpoint @endpoint QuipWeb.Endpoint
use PhoenixTestWeb, :verified_routes use QuipWeb, :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 PhoenixTestWeb.ConnCase import QuipWeb.ConnCase
end end
end end
setup tags do setup tags do
PhoenixTest.DataCase.setup_sandbox(tags) Quip.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 PhoenixTest.DataCase do defmodule Quip.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 PhoenixTest.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 PhoenixTest.DataCase, async: true`, although by setting `use Quip.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 PhoenixTest.DataCase do
using do using do
quote do quote do
alias PhoenixTest.Repo alias Quip.Repo
import Ecto import Ecto
import Ecto.Changeset import Ecto.Changeset
import Ecto.Query import Ecto.Query
import PhoenixTest.DataCase import Quip.DataCase
end end
end end
setup tags do setup tags do
PhoenixTest.DataCase.setup_sandbox(tags) Quip.DataCase.setup_sandbox(tags)
:ok :ok
end end
@ -36,7 +36,7 @@ defmodule PhoenixTest.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!(PhoenixTest.Repo, shared: not tags[:async]) pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Quip.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(PhoenixTest.Repo, :manual) Ecto.Adapters.SQL.Sandbox.mode(Quip.Repo, :manual)