diff --git a/.githooks/pre-commit b/.githooks/pre-commit old mode 100755 new mode 100644 diff --git a/.gitignore b/.gitignore index bc3dc1d..f78c443 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,7 @@ erl_crash.dump /tmp/ # Ignore package tarball (built via "mix hex.build"). -site-*.tar +boardwise-*.tar # Ignore assets that are produced by build tools. /priv/static/assets/ diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 120c142..444f8d5 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -8,8 +8,8 @@ const path = require("path") module.exports = { content: [ "./js/**/*.js", - "../lib/site_web.ex", - "../lib/site_web/**/*.*ex" + "../lib/boardwise_web.ex", + "../lib/boardwise_web/**/*.*ex" ], theme: { extend: { diff --git a/config/config.exs b/config/config.exs index 9c18bc2..303f624 100644 --- a/config/config.exs +++ b/config/config.exs @@ -7,20 +7,21 @@ # General application configuration import Config -config :site, - ecto_repos: [Site.Repo], +config :boardwise, + namespace: BoardWise, + ecto_repos: [BoardWise.Repo], generators: [timestamp_type: :utc_datetime] # Configures the endpoint -config :site, SiteWeb.Endpoint, +config :boardwise, BoardWiseWeb.Endpoint, url: [host: "localhost"], adapter: Phoenix.Endpoint.Cowboy2Adapter, render_errors: [ - formats: [html: SiteWeb.ErrorHTML, json: SiteWeb.ErrorJSON], + formats: [html: BoardWiseWeb.ErrorHTML, json: BoardWiseWeb.ErrorJSON], layout: false ], - pubsub_server: Site.PubSub, - live_view: [signing_salt: "Wq4i8F/W"] + pubsub_server: BoardWise.PubSub, + live_view: [signing_salt: "NutZSMRk"] # Configures the mailer # @@ -29,7 +30,7 @@ config :site, SiteWeb.Endpoint, # # For production it's recommended to configure a different adapter # 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) config :esbuild, diff --git a/config/dev.exs b/config/dev.exs index 55aab28..4cdb8d1 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1,11 +1,11 @@ import Config # Configure your database -config :site, Site.Repo, +config :boardwise, BoardWise.Repo, username: "jrpotter", password: "postgres", hostname: "localhost", - database: "site_dev", + database: "boardwise_dev", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10 @@ -16,14 +16,14 @@ config :site, Site.Repo, # The watchers configuration can be used to run external # watchers to your application. For example, we can use it # to bundle .js and .css sources. -config :site, SiteWeb.Endpoint, +config :boardwise, BoardWiseWeb.Endpoint, # Binding to loopback ipv4 address prevents 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], check_origin: false, code_reloader: true, debug_errors: true, - secret_key_base: "9o2fhxlaKOfOintGZYpUTa4dSiJoPdFk09Yju0mRhfLWsLP26L9i57TBzpe61qcT", + secret_key_base: "5hf4wAGNe1kUPI9qJ+YOA4+05hlFOY3QJRc0RqnXpt01XbR/e5ZCNQHIEO7TR9Uo", watchers: [ esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}, tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]} @@ -53,17 +53,17 @@ config :site, SiteWeb.Endpoint, # different ports. # Watch static and templates for browser reloading. -config :site, SiteWeb.Endpoint, +config :boardwise, BoardWiseWeb.Endpoint, live_reload: [ patterns: [ ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$", ~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 -config :site, dev_routes: true +config :boardwise, dev_routes: true # Do not include metadata nor timestamps in development logs config :logger, :console, format: "[$level] $message\n" diff --git a/config/prod.exs b/config/prod.exs index c293498..a38dae0 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -5,10 +5,10 @@ import Config # manifest is generated by the `mix assets.deploy` task, # which you should run after static files are built and # 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 -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 config :swoosh, local: false diff --git a/config/runtime.exs b/config/runtime.exs index f262412..2acf7a4 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -12,12 +12,12 @@ import Config # If you use `mix release`, you need to explicitly enable the server # 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` # script that automatically sets the env var above. if System.get_env("PHX_SERVER") do - config :site, SiteWeb.Endpoint, server: true + config :boardwise, BoardWiseWeb.Endpoint, server: true end 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: [] - config :site, Site.Repo, + config :boardwise, BoardWise.Repo, # ssl: true, url: database_url, 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" 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"], http: [ # 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 your endpoint configuration: # - # config :site, SiteWeb.Endpoint, + # config :boardwise, BoardWiseWeb.Endpoint, # https: [ # ..., # port: 443, @@ -92,7 +92,7 @@ if config_env() == :prod do # We also recommend setting `force_ssl` in your endpoint, ensuring # no data is ever sent via http, always redirecting to https: # - # config :site, SiteWeb.Endpoint, + # config :boardwise, BoardWiseWeb.Endpoint, # force_ssl: [hsts: true] # # 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 # are not using SMTP. Here is an example of the configuration: # - # config :site, Site.Mailer, + # config :boardwise, BoardWise.Mailer, # adapter: Swoosh.Adapters.Mailgun, # api_key: System.get_env("MAILGUN_API_KEY"), # domain: System.get_env("MAILGUN_DOMAIN") diff --git a/config/test.exs b/config/test.exs index 2ccbf4d..195cda9 100644 --- a/config/test.exs +++ b/config/test.exs @@ -5,23 +5,23 @@ import Config # The MIX_TEST_PARTITION environment variable can be used # to provide built-in test partitioning in CI environment. # Run `mix help test` for more information. -config :site, Site.Repo, +config :boardwise, BoardWise.Repo, username: "postgres", password: "postgres", 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_size: 10 # We don't run a server during test. If one is required, # you can enable the server option below. -config :site, SiteWeb.Endpoint, +config :boardwise, BoardWiseWeb.Endpoint, http: [ip: {127, 0, 0, 1}, port: 4002], - secret_key_base: "T0jFDk3PWnwZCoYdv8l2ZgOk8thliSovjN++aOs6DWMKb7RP6dN+VNR7Ptnja1RW", + secret_key_base: "0Nt/alF0NScLRGMz58M9EOaiFrzuQjeMgwTo4QsBpqkJeRMw1MQvG0OIIgTZVEmF", server: false # 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. config :swoosh, :api_client, false diff --git a/flake.nix b/flake.nix index 03f157c..8e981b6 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ { packages = { app = mixRelease { - pname = "site"; + pname = "boardwise"; src = ./.; version = "0.1.0"; mixNixDeps = deps; diff --git a/lib/site.ex b/lib/boardwise.ex similarity index 69% rename from lib/site.ex rename to lib/boardwise.ex index 217599a..8b9941a 100644 --- a/lib/site.ex +++ b/lib/boardwise.ex @@ -1,6 +1,6 @@ -defmodule Site do +defmodule BoardWise do @moduledoc """ - Site keeps the contexts that define your domain + BoardWise keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless diff --git a/lib/site/application.ex b/lib/boardwise/application.ex similarity index 55% rename from lib/site/application.ex rename to lib/boardwise/application.ex index 2635521..c207cf5 100644 --- a/lib/site/application.ex +++ b/lib/boardwise/application.ex @@ -1,4 +1,4 @@ -defmodule Site.Application do +defmodule BoardWise.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false @@ -8,21 +8,21 @@ defmodule Site.Application do @impl true def start(_type, _args) do children = [ - SiteWeb.Telemetry, - Site.Repo, - {DNSCluster, query: Application.get_env(:site, :dns_cluster_query) || :ignore}, - {Phoenix.PubSub, name: Site.PubSub}, + BoardWiseWeb.Telemetry, + BoardWise.Repo, + {DNSCluster, query: Application.get_env(:boardwise, :dns_cluster_query) || :ignore}, + {Phoenix.PubSub, name: BoardWise.PubSub}, # Start the Finch HTTP client for sending emails - {Finch, name: Site.Finch}, - # Start a worker by calling: Site.Worker.start_link(arg) - # {Site.Worker, arg}, + {Finch, name: BoardWise.Finch}, + # Start a worker by calling: BoardWise.Worker.start_link(arg) + # {BoardWise.Worker, arg}, # Start to serve requests, typically the last entry - SiteWeb.Endpoint + BoardWiseWeb.Endpoint ] # See https://hexdocs.pm/elixir/Supervisor.html # 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) end @@ -30,7 +30,7 @@ defmodule Site.Application do # whenever the application is updated. @impl true def config_change(changed, _new, removed) do - SiteWeb.Endpoint.config_change(changed, removed) + BoardWiseWeb.Endpoint.config_change(changed, removed) :ok end end diff --git a/lib/boardwise/mailer.ex b/lib/boardwise/mailer.ex new file mode 100644 index 0000000..ca89a50 --- /dev/null +++ b/lib/boardwise/mailer.ex @@ -0,0 +1,3 @@ +defmodule BoardWise.Mailer do + use Swoosh.Mailer, otp_app: :boardwise +end diff --git a/lib/site/repo.ex b/lib/boardwise/repo.ex similarity index 51% rename from lib/site/repo.ex rename to lib/boardwise/repo.ex index fa424fd..936ceba 100644 --- a/lib/site/repo.ex +++ b/lib/boardwise/repo.ex @@ -1,5 +1,5 @@ -defmodule Site.Repo do +defmodule BoardWise.Repo do use Ecto.Repo, - otp_app: :site, + otp_app: :boardwise, adapter: Ecto.Adapters.Postgres end diff --git a/lib/site_web.ex b/lib/boardwise_web.ex similarity index 83% rename from lib/site_web.ex rename to lib/boardwise_web.ex index 9e794b4..2e4e639 100644 --- a/lib/site_web.ex +++ b/lib/boardwise_web.ex @@ -1,12 +1,12 @@ -defmodule SiteWeb do +defmodule BoardWiseWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: - use SiteWeb, :controller - use SiteWeb, :html + use BoardWiseWeb, :controller + use BoardWiseWeb, :html The definitions below will be executed for every controller, component, etc, so keep them short and clean, focused @@ -40,10 +40,10 @@ defmodule SiteWeb do quote do use Phoenix.Controller, formats: [:html, :json], - layouts: [html: SiteWeb.Layouts] + layouts: [html: BoardWiseWeb.Layouts] import Plug.Conn - import SiteWeb.Gettext + import BoardWiseWeb.Gettext unquote(verified_routes()) end @@ -52,7 +52,7 @@ defmodule SiteWeb do def live_view do quote do use Phoenix.LiveView, - layout: {SiteWeb.Layouts, :app} + layout: {BoardWiseWeb.Layouts, :app} unquote(html_helpers()) end @@ -84,8 +84,8 @@ defmodule SiteWeb do # HTML escaping functionality import Phoenix.HTML # Core UI components and translation - import SiteWeb.CoreComponents - import SiteWeb.Gettext + import BoardWiseWeb.CoreComponents + import BoardWiseWeb.Gettext # Shortcut for generating JS commands alias Phoenix.LiveView.JS @@ -98,9 +98,9 @@ defmodule SiteWeb do def verified_routes do quote do use Phoenix.VerifiedRoutes, - endpoint: SiteWeb.Endpoint, - router: SiteWeb.Router, - statics: SiteWeb.static_paths() + endpoint: BoardWiseWeb.Endpoint, + router: BoardWiseWeb.Router, + statics: BoardWiseWeb.static_paths() end end diff --git a/lib/site_web/components/core_components.ex b/lib/boardwise_web/components/core_components.ex similarity index 99% rename from lib/site_web/components/core_components.ex rename to lib/boardwise_web/components/core_components.ex index 0afb49d..0f80096 100644 --- a/lib/site_web/components/core_components.ex +++ b/lib/boardwise_web/components/core_components.ex @@ -1,4 +1,4 @@ -defmodule SiteWeb.CoreComponents do +defmodule BoardWiseWeb.CoreComponents do @moduledoc """ Provides core UI components. @@ -17,7 +17,7 @@ defmodule SiteWeb.CoreComponents do use Phoenix.Component alias Phoenix.LiveView.JS - import SiteWeb.Gettext + import BoardWiseWeb.Gettext @doc """ Renders a modal. @@ -659,9 +659,9 @@ defmodule SiteWeb.CoreComponents do # with our gettext backend as first argument. Translations are # available in the errors.po file (as we use the "errors" domain). if count = opts[:count] do - Gettext.dngettext(SiteWeb.Gettext, "errors", msg, msg, count, opts) + Gettext.dngettext(BoardWiseWeb.Gettext, "errors", msg, msg, count, opts) else - Gettext.dgettext(SiteWeb.Gettext, "errors", msg, opts) + Gettext.dgettext(BoardWiseWeb.Gettext, "errors", msg, opts) end end diff --git a/lib/boardwise_web/components/layouts.ex b/lib/boardwise_web/components/layouts.ex new file mode 100644 index 0000000..f4ca6d0 --- /dev/null +++ b/lib/boardwise_web/components/layouts.ex @@ -0,0 +1,5 @@ +defmodule BoardWiseWeb.Layouts do + use BoardWiseWeb, :html + + embed_templates "layouts/*" +end diff --git a/lib/site_web/components/layouts/app.html.heex b/lib/boardwise_web/components/layouts/app.html.heex similarity index 100% rename from lib/site_web/components/layouts/app.html.heex rename to lib/boardwise_web/components/layouts/app.html.heex diff --git a/lib/site_web/components/layouts/root.html.heex b/lib/boardwise_web/components/layouts/root.html.heex similarity index 92% rename from lib/site_web/components/layouts/root.html.heex rename to lib/boardwise_web/components/layouts/root.html.heex index 68bbe5b..b935afc 100644 --- a/lib/site_web/components/layouts/root.html.heex +++ b/lib/boardwise_web/components/layouts/root.html.heex @@ -5,7 +5,7 @@ <.live_title suffix=" ยท Phoenix Framework"> - <%= assigns[:page_title] || "Site" %> + <%= assigns[:page_title] || "BoardWise" %>