From be58824bd329fad7a4520b5ae7ffd581cafc28ee Mon Sep 17 00:00:00 2001 From: Robert Prehn <3952444+prehnRA@users.noreply.github.com> Date: Mon, 1 Mar 2021 15:53:31 -0600 Subject: [PATCH 01/14] feat: Add Alpine to assets --- apps/app/assets/js/app.js | 3 ++- apps/app/assets/package-lock.json | 5 +++++ apps/app/assets/package.json | 1 + apps/core/test/auth_web/plugs/require_admin_test.exs | 9 +++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/app/assets/js/app.js b/apps/app/assets/js/app.js index c7998ec1..bc4627f5 100644 --- a/apps/app/assets/js/app.js +++ b/apps/app/assets/js/app.js @@ -13,6 +13,7 @@ import "../css/app.css" // import socket from "./socket" // import "phoenix_html" +import "alpinejs" import { ready } from "./utils" function togglePasswordFieldVisibility() @@ -22,7 +23,7 @@ function togglePasswordFieldVisibility() if (el.type == 'password') { el.type = 'text' - } + } else { el.type = 'password' diff --git a/apps/app/assets/package-lock.json b/apps/app/assets/package-lock.json index 9135e71b..df446d3c 100644 --- a/apps/app/assets/package-lock.json +++ b/apps/app/assets/package-lock.json @@ -1332,6 +1332,11 @@ "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", "dev": true }, + "alpinejs": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-2.8.1.tgz", + "integrity": "sha512-ETJ/k0fbiBeP+OSd5Fhj70c+zb+YRzcVbyh5DVeLT3FBWMUeUvjOSWLi53IVLPSehaT2SKmB7w08WGF2jYTqNA==" + }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", diff --git a/apps/app/assets/package.json b/apps/app/assets/package.json index 825d13c2..a3988afd 100644 --- a/apps/app/assets/package.json +++ b/apps/app/assets/package.json @@ -9,6 +9,7 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^5.14.0", + "alpinejs": "^2.8.1", "autoprefixer": "^9.8.6", "csswring": "^7.0.0", "glob": "^7.1.6", diff --git a/apps/core/test/auth_web/plugs/require_admin_test.exs b/apps/core/test/auth_web/plugs/require_admin_test.exs index 7cd976a4..f44fa7b8 100644 --- a/apps/core/test/auth_web/plugs/require_admin_test.exs +++ b/apps/core/test/auth_web/plugs/require_admin_test.exs @@ -27,4 +27,13 @@ defmodule AuthWeb.Plugs.RequireAdminTest do assert !conn.halted end + + test "call/2 with a user who is not admin", %{conn: conn} do + conn = + conn + |> Pow.Plug.assign_current_user(%User{roles: []}, []) + |> RequireAdmin.call([]) + + assert conn.halted + end end From 5aaadcb999240f3c554f4a634c5b26735052877c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 1 Mar 2021 23:03:19 +0000 Subject: [PATCH 02/14] chore(release): 1.5.0 [skip ci] --- infrastructure/kube.yaml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/kube.yaml b/infrastructure/kube.yaml index a778b30b..525fa9da 100644 --- a/infrastructure/kube.yaml +++ b/infrastructure/kube.yaml @@ -20,7 +20,7 @@ spec: spec: containers: - name: app - image: registry.gitlab.com/mythic-insight/legendary:1.4.2 + image: registry.gitlab.com/mythic-insight/legendary:1.5.0 ports: - containerPort: 4000 env: diff --git a/package.json b/package.json index b2664878..5b11e1e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mythic-insight/legendary", - "version": "1.4.2", + "version": "1.5.0", "private": true, "description": "The Legendary Phoenix Boilerplate.", "main": "index.js", From c3b07a610413ce81c05950e22dcd353647f85087 Mon Sep 17 00:00:00 2001 From: Robert Prehn <3952444+prehnRA@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:29:49 -0500 Subject: [PATCH 03/14] feat: Add documentation --- LICENSE | 22 ++++++++++++++ README.md | 59 +++++++++++++++++++++++++----------- apps/core/guides/overview.md | 57 ++++++++++++++++++++++++++++++++++ apps/core/mix.exs | 28 +++++++++++++++++ mix.lock | 8 ++++- 5 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 LICENSE create mode 100644 apps/core/guides/overview.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..cfa90eb2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +# MIT License + +Copyright (c) 2020 Robert Prehn & Mythic Insight + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 5595d59c..6498f862 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,27 @@ -# Legendary +# Overview -# Up and Running +Legendary is a boilerplate for developing [PETAL-stack](https://changelog.com/posts/petal-the-end-to-end-web-stack) +Phoenix/Elixir applications without reinventing the wheel. Out-of-the-box, we +include many features that are commonly needed in web applications: + +- Features + - Authentication & Authorization + - Admin interface & dashboard + - Lightweight content management / blogging + - Background & scheduled jobs with Oban +- Frontend Frameworks + - Tailwind CSS + - Alpine JS + - Fluid HTML email templates +- Full CI / DevOps scripts included + +We got tired of setting these things up from scratch on every Phoenix application. +So, we built a boilerplate that lets you start with the unique & interesting thing +that only your application does. We have a roadmap for future feature development +because we still think there are a lot more things we can do to make Phoenix +development better. + +## Up and Running In order to start the server, run `script/server`. Any dependencies required will be installed automatically using [brew](https://brew.sh/), @@ -8,7 +29,24 @@ will be installed automatically using [brew](https://brew.sh/), Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. -# CI Configuration +## Application Development + +Your main app lives in apps/app/ and that is where you will do most of your +development there. This is a normal Phoenix application and you can develop it +as such. Any resources which apply to developing Phoenix applications will apply +inside of the app. See the [Phoenix Guides](https://hexdocs.pm/phoenix/overview.html) +for a good starting resource in Phoenix development. + +You should not generally need to change code in the other applications which +are part of the framework-- admin, content, core. We encourage you to avoid +changing those as much as possible, because doing so will make it more difficult +to upgrade Legendary to newer versions. However, they are available to you if +you find that there are no other ways to accomplish the changes you want to +accomplish. If you find yourself adding functionality to admin, content, or core +that you feel would be beneficial to all Legendary apps, consider making a +code contribution back to the framework! + +## CI Configuration Legendary comes with gitlab CI settings which should work for you with minimal setup. @@ -17,18 +55,3 @@ The CI script will automatically tag successful builds. To do this, you will need to configure a [CI variable](-/settings/ci_cd) named `GITLAB_TOKEN`. This token should be a [personal access token](/-/profile/personal_access_tokens) with `read_repository, write_repository` permissions. - -To start your Phoenix server: - - * Install dependencies with `mix deps.get` - * Create and migrate your database with `mix ecto.setup` - * Install Node.js dependencies with `npm install` inside the `assets` directory - * Start Phoenix endpoint with `mix phx.server` - -# Learn more - - * Official website: https://www.phoenixframework.org/ - * Guides: https://hexdocs.pm/phoenix/overview.html - * Docs: https://hexdocs.pm/phoenix - * Forum: https://elixirforum.com/c/phoenix-forum - * Source: https://github.com/phoenixframework/phoenix diff --git a/apps/core/guides/overview.md b/apps/core/guides/overview.md new file mode 100644 index 00000000..832d9522 --- /dev/null +++ b/apps/core/guides/overview.md @@ -0,0 +1,57 @@ +# Overview + +Legendary is a boilerplate for developing [PETAL-stack](https://changelog.com/posts/petal-the-end-to-end-web-stack) +Phoenix/Elixir applications without reinventing the wheel. Out-of-the-box, we +include many features that are commonly needed in web applications: + +- Features + - Authentication & Authorization + - Admin interface & dashboard + - Lightweight content management / blogging + - Background & scheduled jobs with Oban +- Frontend Frameworks + - Tailwind CSS + - Alpine JS + - Fluid HTML email templates +- Full CI / DevOps scripts included + +We got tired of setting these things up from scratch on every Phoenix application. +So, we built a boilerplate that lets you start with the unique & interesting thing +that only your application does. We have a roadmap for future feature development +because we still think there are a lot more things we can do to make Phoenix +development better. + +## Up and Running + +In order to start the server, run `script/server`. Any dependencies required +will be installed automatically using [brew](https://brew.sh/), +[asdf](https://asdf-vm.com/#/), and [hex](https://hex.pm/). + +Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. + +## Development + +Your main app lives in apps/app/ and that is where you will do most of your +development there. This is a normal Phoenix application and you can develop it +as such. Any resources which apply to developing Phoenix applications will apply +inside of the app. See the [Phoenix Guides](https://hexdocs.pm/phoenix/overview.html) +for a good starting resource in Phoenix development. + +You should not generally need to change code in the other applications which +are part of the framework-- admin, content, core. We encourage you to avoid +changing those as much as possible, because doing so will make it more difficult +to upgrade Legendary to newer versions. However, they are available to you if +you find that there are no other ways to accomplish the changes you want to +accomplish. If you find yourself adding functionality to admin, content, or core +that you feel would be beneficial to all Legendary apps, consider making a +code contribution back to the framework! + +## CI Configuration + +Legendary comes with gitlab CI settings which should work for you with minimal +setup. + +The CI script will automatically tag successful builds. To do this, you will +need to configure a [CI variable](-/settings/ci_cd) named `GITLAB_TOKEN`. This +token should be a [personal access token](/-/profile/personal_access_tokens) with +`read_repository, write_repository` permissions. diff --git a/apps/core/mix.exs b/apps/core/mix.exs index d25aef7e..dff319ed 100644 --- a/apps/core/mix.exs +++ b/apps/core/mix.exs @@ -17,9 +17,36 @@ defmodule Core.MixProject do deps: deps(), test_coverage: [tool: ExCoveralls], preferred_cli_env: [coveralls: :test, "coveralls.detail": :test, "coveralls.post": :test, "coveralls.html": :test], + + # Docs + name: "Legendary", + source_url: "https://gitlab.com/mythic-insight/legendary", + homepage_url: "https://legendaryframework.org/", + docs: [ + main: "overview", + extra_section: "GUIDES", + extras: extras() + ], + + # Hex + description: """ + A PETAL-stack batteries-included boilerplate for making Phoenix apps + without tedium. + """, + package: [ + name: "legendary_core", + maintainers: ["Robert Prehn"], + organization: "mythic_insight", + licenses: ["MIT"], + links: %{"GitLab" => "https://gitlab.com/mythic-insight/legendary"} + ] ] end + defp extras do + Path.wildcard("guides/**/*.md") + end + # Configuration for the OTP application. # # Type `mix help compile.app` for more information. @@ -42,6 +69,7 @@ defmodule Core.MixProject do {:bamboo, "~> 1.5"}, {:credo, "~> 1.4", only: [:dev, :test], runtime: false}, {:ex_cldr, "~> 2.13.0"}, + {:ex_doc, "~> 0.24", only: :dev, runtime: false}, {:excoveralls, "~> 0.10", only: [:dev, :test]}, {:phoenix, "~> 1.5.3"}, {:phoenix_ecto, "~> 4.1"}, diff --git a/mix.lock b/mix.lock index d7646981..f6538591 100644 --- a/mix.lock +++ b/mix.lock @@ -16,11 +16,13 @@ "decimal": {:hex, :decimal, "1.9.0", "83e8daf59631d632b171faabafb4a9f4242c514b0a06ba3df493951c08f64d07", [:mix], [], "hexpm", "b1f2343568eed6928f3e751cf2dffde95bfaa19dd95d09e8a9ea92ccfd6f7d85"}, "dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"}, "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.12", "b245e875ec0a311a342320da0551da407d9d2b65d98f7a9597ae078615af3449", [:mix], [], "hexpm", "711e2cc4d64abb7d566d43f54b78f7dc129308a63bc103fbd88550d2174b3160"}, "ecto": {:hex, :ecto, "3.4.6", "08f7afad3257d6eb8613309af31037e16c36808dfda5a3cd0cb4e9738db030e4", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6f13a9e2a62e75c2dcfc7207bfc65645ab387af8360db4c89fee8b5a4bf3f70b"}, "ecto_sql": {:hex, :ecto_sql, "3.4.4", "d28bac2d420f708993baed522054870086fd45016a9d09bb2cd521b9c48d32ea", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "edb49af715dd72f213b66adfd0f668a43c17ed510b5d9ac7528569b23af57fe8"}, "elixir_make": {:hex, :elixir_make, "0.6.0", "38349f3e29aff4864352084fc736fa7fa0f2995a819a737554f7ebd28b85aaab", [:mix], [], "hexpm", "d522695b93b7f0b4c0fcb2dfe73a6b905b1c301226a5a55cb42e5b14d509e050"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_cldr": {:hex, :ex_cldr, "2.13.0", "742f14a4afcfea61a190d603d8e555d2c91d71e4e8fc2520d5dc35616969e225", [:mix], [{:cldr_utils, "~> 2.3", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.13", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "5e4cf3e945ee60156a3342e2a762f69036ffbe1f80520cc88592d68f12c5db55"}, + "ex_doc": {:hex, :ex_doc, "0.24.0", "2df14354835afaabdf87cb2971ea9485d8a36ff590e4b6c250b4f60c8fdf9143", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "a0f4bcff21ceebea48414e49885d2a3e542200f76a2facf3f8faa54935eeb721"}, "ex_prompt": {:hex, :ex_prompt, "0.1.5", "b136642d0962f8ea37b3c9fa185ad1f42c71c3b9c6c3950f0358d7f3d2db2970", [:mix], [], "hexpm", "ad19a404708c9c7b05d36090b2d074ceafbed248a8de1a22d45a05ebe6994b83"}, "excoveralls": {:hex, :excoveralls, "0.13.0", "4e1b7cc4e0351d8d16e9be21b0345a7e165798ee5319c7800b9138ce17e0b38e", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "fe2a56c8909564e2e6764765878d7d5e141f2af3bc8ff3b018a68ee2a218fced"}, "file_system": {:hex, :file_system, "0.2.8", "f632bd287927a1eed2b718f22af727c5aeaccc9a98d8c2bd7bff709e851dc986", [:mix], [], "hexpm", "97a3b6f8d63ef53bd0113070102db2ce05352ecf0d25390eb8d747c2bde98bca"}, @@ -36,6 +38,9 @@ "kaffy": {:hex, :kaffy, "0.9.0", "bef34c9729f6a3af4d0dea8eede8bcb9e11371a83ac9a8b393991bce81839517", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.11", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "d18ff57b8e68feb433aed11e71510cd357abc7034e75358af5deff7d0d4c6ed3"}, "libring": {:hex, :libring, "1.5.0", "44313eb6862f5c9168594a061e9d5f556a9819da7c6444706a9e2da533396d70", [:mix], [], "hexpm", "04e843d4fdcff49a62d8e03778d17c6cb2a03fe2d14020d3825a1761b55bd6cc"}, "linguist": {:hex, :linguist, "0.3.1", "8ce81114691be8ef4a122e7f57bd1842bc96b1f5650b66b246d7035238cab69d", [:mix], [{:ex_cldr, "~> 2.0", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.0", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "5b06f97912e298f60dd00bc6a588b1fe1ec8838b268e4fdbf4443a25511f0614"}, + "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, "meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "1.5.0", "203ef35ef3389aae6d361918bf3f952fa17a09e8e43b5aa592b93eba05d0fb8d", [:mix], [], "hexpm", "55a94c0f552249fc1a3dd9cd2d3ab9de9d3c89b559c2bd01121f824834f24746"}, @@ -43,6 +48,7 @@ "mochiweb": {:hex, :mochiweb, "2.12.2", "80804ad342afa3d7f3524040d4eed66ce74b17a555de454ac85b07c479928e46", [:make, :rebar], [], "hexpm", "d3e681d4054b74a96cf2efcd09e94157ab83a5f55ddc4ce69f90b8144673bd7a"}, "mock": {:hex, :mock, "0.3.5", "feb81f52b8dcf0a0d65001d2fec459f6b6a8c22562d94a965862f6cc066b5431", [:mix], [{:meck, "~> 0.8.13", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "6fae404799408300f863550392635d8f7e3da6b71abdd5c393faf41b131c8728"}, "neotomex": {:hex, :neotomex, "0.1.7", "64f76513653aa87ea7abdde0fd600e56955d838020a13d88f2bf334c88ac3e7a", [:mix], [], "hexpm", "4b87b8f614d1cd89dc8ba80ba0e559bedb3ebf6f6d74cd774fcfdd215e861445"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, "oban": {:hex, :oban, "2.1.0", "034144686f7e76a102b5d67731f098d98a9e4a52b07c25ad580a01f83a7f1cf5", [:mix], [{:ecto_sql, ">= 3.4.3", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c6f067fa3b308ed9e0e6beb2b34277c9c4e48bf95338edabd8f4a757a26e04c2"}, "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"}, "phoenix": {:hex, :phoenix, "1.5.8", "71cfa7a9bb9a37af4df98939790642f210e35f696b935ca6d9d9c55a884621a4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "35ded0a32f4836168c7ab6c33b88822eccd201bcd9492125a9bea4c54332d955"}, @@ -54,7 +60,7 @@ "phoenix_live_view": {:hex, :phoenix_live_view, "0.13.3", "2186c55cc7c54ca45b97c6f28cfd267d1c61b5f205f3c83533704cd991bdfdec", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.4.17 or ~> 1.5.2", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "c6309a7da2e779cb9cdf2fb603d75f38f49ef324bedc7a81825998bd1744ff8a"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"}, "php_serializer": {:hex, :php_serializer, "0.9.2", "59c5fd6bd3096671fd89358fb8229341ac7423b50ad8d45a15213b02ea2edab2", [:mix], [], "hexpm", "34eb835a460944f7fc216773b363c02e7dcf8ac0390c9e9ccdbd92b31a7ca59a"}, - "plug": {:hex, :plug, "1.11.0", "f17217525597628298998bc3baed9f8ea1fa3f1160aa9871aee6df47a6e4d38e", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2d9c633f0499f9dc5c2fd069161af4e2e7756890b81adcbb2ceaa074e8308876"}, + "plug": {:hex, :plug, "1.11.1", "f2992bac66fdae679453c9e86134a4201f6f43a687d8ff1cd1b2862d53c80259", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "23524e4fefbb587c11f0833b3910bfb414bf2e2534d61928e920f54e3a1b881f"}, "plug_cowboy": {:hex, :plug_cowboy, "2.4.1", "779ba386c0915027f22e14a48919a9545714f849505fa15af2631a0d298abf0f", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d72113b6dff7b37a7d9b2a5b68892808e3a9a752f2bf7e503240945385b70507"}, "plug_crypto": {:hex, :plug_crypto, "1.2.1", "5c854427528bf61d159855cedddffc0625e2228b5f30eff76d5a4de42d896ef4", [:mix], [], "hexpm", "6961c0e17febd9d0bfa89632d391d2545d2e0eb73768f5f50305a23961d8782c"}, "postgrex": {:hex, :postgrex, "0.15.5", "aec40306a622d459b01bff890fa42f1430dac61593b122754144ad9033a2152f", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "ed90c81e1525f65a2ba2279dbcebf030d6d13328daa2f8088b9661eb9143af7f"}, From 5dc47d743a2fb69d6fb2eb3741943d29cd35da95 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 19 Mar 2021 17:49:50 +0000 Subject: [PATCH 04/14] chore(release): 1.6.0 [skip ci] --- infrastructure/kube.yaml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/kube.yaml b/infrastructure/kube.yaml index 525fa9da..0fe23275 100644 --- a/infrastructure/kube.yaml +++ b/infrastructure/kube.yaml @@ -20,7 +20,7 @@ spec: spec: containers: - name: app - image: registry.gitlab.com/mythic-insight/legendary:1.5.0 + image: registry.gitlab.com/mythic-insight/legendary:1.6.0 ports: - containerPort: 4000 env: diff --git a/package.json b/package.json index 5b11e1e7..01da85bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mythic-insight/legendary", - "version": "1.5.0", + "version": "1.6.0", "private": true, "description": "The Legendary Phoenix Boilerplate.", "main": "index.js", From 5f6a9d201fe9dd08cd1a926068dff220a36e341d Mon Sep 17 00:00:00 2001 From: Robert Prehn Date: Fri, 19 Mar 2021 19:32:18 +0000 Subject: [PATCH 05/14] BREAKING CHANGE: Namespace all framework modules under Legendary --- apps/admin/lib/admin.ex | 22 +++++++------- apps/admin/lib/admin/application.ex | 16 +++++----- apps/admin/lib/admin/channels/user_socket.ex | 6 ++-- apps/admin/lib/admin/endpoint.ex | 6 ++-- apps/admin/lib/admin/gettext.ex | 4 +-- apps/admin/lib/admin/repo.ex | 2 +- apps/admin/lib/admin/router.ex | 8 ++--- apps/admin/lib/admin/routes.ex | 2 +- apps/admin/lib/admin/telemetry.ex | 4 +-- apps/admin/lib/admin/views/error_helpers.ex | 10 +++---- apps/admin/lib/admin/views/error_view.ex | 4 +-- apps/admin/lib/admin/views/layout_view.ex | 4 +-- apps/admin/lib/admin/views/page_view.ex | 4 +-- apps/admin/lib/kaffy/config.ex | 4 +-- apps/admin/lib/kaffy/editor_extension.ex | 2 +- apps/admin/mix.exs | 4 +-- apps/admin/priv/repo/seeds.exs | 2 +- .../controllers/page_controller_test.exs | 4 +-- .../test/admin/views/error_helpers_test.exs | 6 ++-- .../test/admin/views/error_view_test.exs | 8 ++--- .../test/admin/views/layout_view_test.exs | 4 +-- .../admin/test/admin/views/page_view_test.exs | 4 +-- apps/admin/test/support/channel_case.ex | 12 ++++---- apps/admin/test/support/conn_case.ex | 14 ++++----- apps/admin/test/test_helper.exs | 2 +- apps/app/lib/app_web.ex | 2 +- apps/app/lib/app_web/router.ex | 6 ++-- .../app_web/templates/layout/_menu.html.eex | 4 +-- apps/app/lib/app_web/views/layout_view.ex | 4 +-- apps/app/test/app/views/layout_view_test.exs | 4 +-- apps/content/lib/content/application.ex | 18 +++++------ apps/content/lib/content/attachment.ex | 4 +-- apps/content/lib/content/comment.ex | 4 +-- apps/content/lib/content/comment_admin.ex | 2 +- apps/content/lib/content/commentmeta.ex | 2 +- apps/content/lib/content/comments.ex | 6 ++-- apps/content/lib/content/link.ex | 2 +- apps/content/lib/content/markup_field.ex | 4 +-- apps/content/lib/content/option.ex | 2 +- apps/content/lib/content/options.ex | 6 ++-- apps/content/lib/content/post.ex | 18 +++++------ apps/content/lib/content/post_admin.ex | 10 +++---- apps/content/lib/content/postmeta.ex | 4 +-- apps/content/lib/content/posts.ex | 10 +++---- apps/content/lib/content/repo.ex | 2 +- apps/content/lib/content/sitemap.ex | 6 ++-- apps/content/lib/content/sitemap_storage.ex | 4 +-- apps/content/lib/content/slugs.ex | 4 +-- apps/content/lib/content/term.ex | 2 +- apps/content/lib/content/term_relationship.ex | 12 ++++---- apps/content/lib/content/term_taxonomy.ex | 4 +-- apps/content/lib/content/termmeta.ex | 2 +- apps/content/lib/content/terms.ex | 6 ++-- apps/content/lib/content_web.ex | 24 +++++++-------- .../lib/content_web/channels/user_socket.ex | 6 ++-- .../controllers/comment_controller.ex | 11 ++++--- .../controllers/feeds_controller.ex | 6 ++-- .../controllers/post_password_controller.ex | 4 +-- .../controllers/posts_controller.ex | 8 ++--- .../controllers/sitemap_controller.ex | 6 ++-- apps/content/lib/content_web/endpoint.ex | 6 ++-- apps/content/lib/content_web/gettext.ex | 4 +-- apps/content/lib/content_web/router.ex | 8 ++--- apps/content/lib/content_web/routes.ex | 8 ++--- apps/content/lib/content_web/telemetry.ex | 4 +-- .../content_web/templates/feeds/index.rss.eex | 4 +-- .../templates/posts/comments.html.eex | 2 +- .../templates/posts/front.html.eex | 2 +- .../templates/posts/index.html.eex | 12 ++++---- .../templates/posts/pagination.html.eex | 4 +-- .../content_web/templates/posts/show.html.eex | 4 +-- .../posts/static_pages/index.html.eex | 6 ++-- .../templates/posts/thumb.html.eex | 4 +-- .../lib/content_web/views/admin_home_view.ex | 4 +-- .../lib/content_web/views/admin_posts_view.ex | 4 +-- .../lib/content_web/views/error_helpers.ex | 6 ++-- .../lib/content_web/views/error_view.ex | 4 +-- .../lib/content_web/views/feeds_view.ex | 8 ++--- .../lib/content_web/views/layout_view.ex | 26 ++++++++-------- .../lib/content_web/views/menus_view.ex | 4 +-- .../lib/content_web/views/page_view.ex | 4 +-- .../lib/content_web/views/posts_view.ex | 10 +++---- .../lib/content_web/views/sitemap_view.ex | 4 +-- apps/content/mix.exs | 4 +-- .../20180825175607_create_schema.exs | 2 +- .../20201009173604_add_oban_jobs_table.exs | 2 +- apps/content/priv/repo/seeds.exs | 2 +- apps/content/test/content/attachment_test.exs | 12 ++++---- .../content/test/content/commentmeta_test.exs | 6 ++-- apps/content/test/content/comments_test.exs | 6 ++-- apps/content/test/content/link_test.exs | 6 ++-- .../test/content/markup_field_test.exs | 6 ++-- apps/content/test/content/option_test.exs | 6 ++-- apps/content/test/content/options_test.exs | 6 ++-- apps/content/test/content/postmeta_test.exs | 6 ++-- apps/content/test/content/posts_test.exs | 6 ++-- apps/content/test/content/slugs_test.exs | 6 ++-- .../test/content/term_relationship_test.exs | 6 ++-- .../test/content/term_taxonomy_test.exs | 6 ++-- apps/content/test/content/term_test.exs | 6 ++-- apps/content/test/content/termmeta_test.exs | 6 ++-- .../controllers/comment_controller_test.exs | 8 ++--- .../controllers/feeds_controller_test.exs | 6 ++-- .../post_password_controller_test.exs | 5 ++-- .../controllers/posts_controller_test.exs | 15 +++++----- .../controllers/sitemap_controller_test.exs | 4 +-- .../content_web/views/error_view_test.exs | 8 ++--- .../content_web/views/layout_view_test.exs | 20 ++++++------- .../test/content_web/views/page_view_test.exs | 4 +-- .../content_web/views/posts_view_test.exs | 6 ++-- apps/content/test/support/channel_case.ex | 12 ++++---- apps/content/test/support/conn_case.ex | 16 +++++----- apps/content/test/support/data_case.ex | 10 +++---- apps/content/test/test_helper.exs | 2 +- apps/core/lib/auth.ex | 4 +-- apps/core/lib/auth/roles.ex | 4 +-- apps/core/lib/auth/user.ex | 4 +-- apps/core/lib/auth/user_admin.ex | 10 +++---- apps/core/lib/auth_web.ex | 28 ++++++++--------- apps/core/lib/auth_web/helpers.ex | 4 +-- apps/core/lib/auth_web/plugs/require_admin.ex | 4 +-- apps/core/lib/auth_web/pow/mailer.ex | 8 ++--- apps/core/lib/auth_web/views/error_view.ex | 4 +-- apps/core/lib/auth_web/views/layout_view.ex | 4 +-- apps/core/lib/auth_web/views/page_view.ex | 4 +-- .../core/lib/auth_web/views/pow/email_view.ex | 4 +-- .../auth_web/views/pow/registration_view.ex | 4 +-- .../lib/auth_web/views/pow/session_view.ex | 4 +-- .../pow_email_confirmation/mailer_view.ex | 4 +-- .../views/pow_reset_password/mailer_view.ex | 4 +-- .../pow_reset_password/reset_password_view.ex | 6 ++-- apps/core/lib/core.ex | 4 +-- apps/core/lib/core/application.ex | 18 +++++------ apps/core/lib/core/map_utils.ex | 2 +- apps/core/lib/core/repo.ex | 2 +- .../lib/core/shared_db_connection_pool.ex | 6 ++-- apps/core/lib/core_email.ex | 8 ++--- apps/core/lib/core_mailer.ex | 2 +- apps/core/lib/core_web.ex | 28 ++++++++--------- .../core/lib/core_web/channels/user_socket.ex | 6 ++-- apps/core/lib/core_web/endpoint.ex | 6 ++-- apps/core/lib/core_web/gettext.ex | 4 +-- apps/core/lib/core_web/router.ex | 6 ++-- apps/core/lib/core_web/telemetry.ex | 4 +-- .../lib/core_web/views/core_email_view.ex | 6 ++-- apps/core/lib/core_web/views/email_helpers.ex | 10 +++---- apps/core/lib/core_web/views/error_helpers.ex | 6 ++-- apps/core/lib/core_web/views/error_view.ex | 4 +-- apps/core/lib/core_web/views/helpers.ex | 6 ++-- apps/core/lib/core_web/views/layout_view.ex | 4 +-- apps/core/lib/i18n.ex | 2 +- apps/core/lib/mix/tasks/create_admin.ex | 4 +-- apps/core/mix.exs | 4 +-- .../20200714154549_create_users.exs | 2 +- ...21_add_pow_email_confirmation_to_users.exs | 2 +- .../20200717182733_add_roles_to_users.exs | 2 +- .../20200721214958_add_nicename_to_users.exs | 2 +- .../20200721215212_add_url_to_users.exs | 2 +- apps/core/priv/repo/seeds.exs | 2 +- apps/core/test/auth/roles_test.exs | 8 ++--- apps/core/test/auth/user_test.exs | 8 ++--- apps/core/test/auth_web/helpers_test.exs | 8 ++--- .../auth_web/plugs/require_admin_test.exs | 8 ++--- apps/core/test/auth_web/pow/mailer_test.exs | 6 ++-- .../test/auth_web/views/error_view_test.exs | 8 ++--- .../test/auth_web/views/layout_view_test.exs | 4 +-- .../test/auth_web/views/page_view_test.exs | 4 +-- apps/core/test/core/core_email_test.exs | 4 +-- apps/core/test/core/map_utils_test.exs | 6 ++-- .../core_web/views/email_helpers_test.exs | 8 ++--- .../core_web/views/error_helpers_test.exs | 6 ++-- .../test/core_web/views/error_view_test.exs | 8 ++--- .../core/test/core_web/views/helpers_test.exs | 8 ++--- .../test/core_web/views/layout_view_test.exs | 4 +-- .../test/core_web/views/page_view_test.exs | 4 +-- apps/core/test/mix/legendary_test.exs | 2 +- apps/core/test/support/channel_case.ex | 12 ++++---- apps/core/test/support/conn_case.ex | 14 ++++----- apps/core/test/support/data_case.ex | 12 ++++---- apps/core/test/test_helper.exs | 2 +- config/admin.exs | 20 ++++++------- config/config.exs | 30 +++++++++---------- config/dev.exs | 16 +++++----- config/prod.exs | 20 ++++++------- config/test.exs | 16 +++++----- mix.exs | 1 + 186 files changed, 619 insertions(+), 621 deletions(-) diff --git a/apps/admin/lib/admin.ex b/apps/admin/lib/admin.ex index d9e27293..189888db 100644 --- a/apps/admin/lib/admin.ex +++ b/apps/admin/lib/admin.ex @@ -1,12 +1,12 @@ -defmodule Admin do +defmodule Legendary.Admin do @moduledoc """ The entrypoint for defining your web interface, such as controllers, views, channels and so on. This can be used in your application as: - use Admin, :controller - use Admin, :view + use Legendary.Admin, :controller + use Legendary.Admin, :view The definitions below will be executed for every view, controller, etc, so keep them short and clean, focused @@ -19,11 +19,11 @@ defmodule Admin do def controller do quote do - use Phoenix.Controller, namespace: Admin + use Phoenix.Controller, namespace: Legendary.Admin import Plug.Conn - import Admin.Gettext - alias Admin.Router.Helpers, as: Routes + import Legendary.Admin.Gettext + alias Legendary.Admin.Router.Helpers, as: Routes end end @@ -31,7 +31,7 @@ defmodule Admin do quote do use Phoenix.View, root: "lib/admin/templates", - namespace: Admin + namespace: Legendary.Admin # Import convenience functions from controllers import Phoenix.Controller, @@ -54,7 +54,7 @@ defmodule Admin do def channel do quote do use Phoenix.Channel - import Admin.Gettext + import Legendary.Admin.Gettext end end @@ -66,9 +66,9 @@ defmodule Admin do # Import basic rendering functionality (render, render_layout, etc) import Phoenix.View - import Admin.ErrorHelpers - import Admin.Gettext - alias Admin.Router.Helpers, as: Routes + import Legendary.Admin.ErrorHelpers + import Legendary.Admin.Gettext + alias Legendary.Admin.Router.Helpers, as: Routes end end diff --git a/apps/admin/lib/admin/application.ex b/apps/admin/lib/admin/application.ex index 64c18713..1507c565 100644 --- a/apps/admin/lib/admin/application.ex +++ b/apps/admin/lib/admin/application.ex @@ -1,4 +1,4 @@ -defmodule Admin.Application do +defmodule Legendary.Admin.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false @@ -7,25 +7,25 @@ defmodule Admin.Application do def start(_type, _args) do children = [ - Admin.Repo, + Legendary.Admin.Repo, # Start the Telemetry supervisor - Admin.Telemetry, + Legendary.Admin.Telemetry, # Start the Endpoint (http/https) - Admin.Endpoint - # Start a worker by calling: Admin.Worker.start_link(arg) - # {Admin.Worker, arg} + Legendary.Admin.Endpoint + # Start a worker by calling: Legendary.Admin.Worker.start_link(arg) + # {Legendary.Admin.Worker, arg} ] # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options - opts = [strategy: :one_for_one, name: Admin.Supervisor] + opts = [strategy: :one_for_one, name: Legendary.Admin.Supervisor] Supervisor.start_link(children, opts) end # Tell Phoenix to update the endpoint configuration # whenever the application is updated. def config_change(changed, _new, removed) do - Admin.Endpoint.config_change(changed, removed) + Legendary.Admin.Endpoint.config_change(changed, removed) :ok end end diff --git a/apps/admin/lib/admin/channels/user_socket.ex b/apps/admin/lib/admin/channels/user_socket.ex index 28d4fc87..f8ec5bfd 100644 --- a/apps/admin/lib/admin/channels/user_socket.ex +++ b/apps/admin/lib/admin/channels/user_socket.ex @@ -1,8 +1,8 @@ -defmodule Admin.UserSocket do +defmodule Legendary.Admin.UserSocket do use Phoenix.Socket ## Channels - # channel "room:*", Admin.RoomChannel + # channel "room:*", Legendary.Admin.RoomChannel # Socket params are passed from the client and can # be used to verify and authenticate a user. After @@ -27,7 +27,7 @@ defmodule Admin.UserSocket do # Would allow you to broadcast a "disconnect" event and terminate # all active sockets and channels for a given user: # - # Admin.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{}) + # Legendary.Admin.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{}) # # Returning `nil` makes this socket anonymous. @impl true diff --git a/apps/admin/lib/admin/endpoint.ex b/apps/admin/lib/admin/endpoint.ex index 96378b61..db654fbd 100644 --- a/apps/admin/lib/admin/endpoint.ex +++ b/apps/admin/lib/admin/endpoint.ex @@ -1,4 +1,4 @@ -defmodule Admin.Endpoint do +defmodule Legendary.Admin.Endpoint do use Phoenix.Endpoint, otp_app: :admin def init(_, config) do @@ -17,7 +17,7 @@ defmodule Admin.Endpoint do signing_salt: "zGdDhvUt" ] - socket "/socket", Admin.UserSocket, + socket "/socket", Legendary.Admin.UserSocket, websocket: true, longpoll: false @@ -58,5 +58,5 @@ defmodule Admin.Endpoint do plug Plug.Head plug Plug.Session, @session_options plug Pow.Plug.Session, otp_app: :admin - plug Admin.Router + plug Legendary.Admin.Router end diff --git a/apps/admin/lib/admin/gettext.ex b/apps/admin/lib/admin/gettext.ex index 2834ccf2..2e514e64 100644 --- a/apps/admin/lib/admin/gettext.ex +++ b/apps/admin/lib/admin/gettext.ex @@ -1,11 +1,11 @@ -defmodule Admin.Gettext do +defmodule Legendary.Admin.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: - import Admin.Gettext + import Legendary.Admin.Gettext # Simple translation gettext("Here is the string to translate") diff --git a/apps/admin/lib/admin/repo.ex b/apps/admin/lib/admin/repo.ex index c40e6c5e..c7494cee 100644 --- a/apps/admin/lib/admin/repo.ex +++ b/apps/admin/lib/admin/repo.ex @@ -1,4 +1,4 @@ -defmodule Admin.Repo do +defmodule Legendary.Admin.Repo do use Ecto.Repo, otp_app: :admin, adapter: Ecto.Adapters.Postgres diff --git a/apps/admin/lib/admin/router.ex b/apps/admin/lib/admin/router.ex index 94ad84d5..63723e33 100644 --- a/apps/admin/lib/admin/router.ex +++ b/apps/admin/lib/admin/router.ex @@ -1,5 +1,5 @@ -defmodule Admin.Router do - use Admin, :router +defmodule Legendary.Admin.Router do + use Legendary.Admin, :router pipeline :browser do plug :accepts, ["html"] @@ -10,12 +10,12 @@ defmodule Admin.Router do end pipeline :require_admin do - plug AuthWeb.Plugs.RequireAdmin + plug Legendary.AuthWeb.Plugs.RequireAdmin end pipeline :api do plug :accepts, ["json"] end - use Admin.Routes + use Legendary.Admin.Routes end diff --git a/apps/admin/lib/admin/routes.ex b/apps/admin/lib/admin/routes.ex index 92fc4125..64d2b94c 100644 --- a/apps/admin/lib/admin/routes.ex +++ b/apps/admin/lib/admin/routes.ex @@ -1,4 +1,4 @@ -defmodule Admin.Routes do +defmodule Legendary.Admin.Routes do defmacro __using__(_opts \\ []) do quote do use Kaffy.Routes, scope: "/admin", pipe_through: [:require_admin] diff --git a/apps/admin/lib/admin/telemetry.ex b/apps/admin/lib/admin/telemetry.ex index a545e89c..44ee3dc0 100644 --- a/apps/admin/lib/admin/telemetry.ex +++ b/apps/admin/lib/admin/telemetry.ex @@ -1,4 +1,4 @@ -defmodule Admin.Telemetry do +defmodule Legendary.Admin.Telemetry do use Supervisor import Telemetry.Metrics @@ -49,7 +49,7 @@ defmodule Admin.Telemetry do [ # A module, function and arguments to be invoked periodically. # This function must call :telemetry.execute/3 and a metric must be added above. - # {Admin, :count_users, []} + # {Legendary.Admin, :count_users, []} ] end end diff --git a/apps/admin/lib/admin/views/error_helpers.ex b/apps/admin/lib/admin/views/error_helpers.ex index 7154dd65..890304e4 100644 --- a/apps/admin/lib/admin/views/error_helpers.ex +++ b/apps/admin/lib/admin/views/error_helpers.ex @@ -1,12 +1,12 @@ -defmodule Admin.ErrorHelpers do +defmodule Legendary.Admin.ErrorHelpers do @moduledoc """ Conveniences for translating and building error messages. """ use Phoenix.HTML - defdelegate error_tag(form, field), to: CoreWeb.ErrorHelpers - defdelegate error_tag(form, field, opts), to: CoreWeb.ErrorHelpers + defdelegate error_tag(form, field), to: Legendary.CoreWeb.ErrorHelpers + defdelegate error_tag(form, field, opts), to: Legendary.CoreWeb.ErrorHelpers @doc """ Translates an error message using gettext. @@ -30,9 +30,9 @@ defmodule Admin.ErrorHelpers do # should be written to the errors.po file. The :count option is # set by Ecto and indicates we should also apply plural rules. if count = opts[:count] do - Gettext.dngettext(Admin.Gettext, "errors", msg, msg, count, opts) + Gettext.dngettext(Legendary.Admin.Gettext, "errors", msg, msg, count, opts) else - Gettext.dgettext(Admin.Gettext, "errors", msg, opts) + Gettext.dgettext(Legendary.Admin.Gettext, "errors", msg, opts) end end end diff --git a/apps/admin/lib/admin/views/error_view.ex b/apps/admin/lib/admin/views/error_view.ex index f2e57b44..134ea57d 100644 --- a/apps/admin/lib/admin/views/error_view.ex +++ b/apps/admin/lib/admin/views/error_view.ex @@ -1,5 +1,5 @@ -defmodule Admin.ErrorView do - use Admin, :view +defmodule Legendary.Admin.ErrorView do + use Legendary.Admin, :view # If you want to customize a particular status code # for a certain format, you may uncomment below. diff --git a/apps/admin/lib/admin/views/layout_view.ex b/apps/admin/lib/admin/views/layout_view.ex index 745cc046..b01d71bb 100644 --- a/apps/admin/lib/admin/views/layout_view.ex +++ b/apps/admin/lib/admin/views/layout_view.ex @@ -1,3 +1,3 @@ -defmodule Admin.LayoutView do - use Admin, :view +defmodule Legendary.Admin.LayoutView do + use Legendary.Admin, :view end diff --git a/apps/admin/lib/admin/views/page_view.ex b/apps/admin/lib/admin/views/page_view.ex index 4cbfd520..5992b0c3 100644 --- a/apps/admin/lib/admin/views/page_view.ex +++ b/apps/admin/lib/admin/views/page_view.ex @@ -1,3 +1,3 @@ -defmodule Admin.PageView do - use Admin, :view +defmodule Legendary.Admin.PageView do + use Legendary.Admin, :view end diff --git a/apps/admin/lib/kaffy/config.ex b/apps/admin/lib/kaffy/config.ex index b103692a..431b809a 100644 --- a/apps/admin/lib/kaffy/config.ex +++ b/apps/admin/lib/kaffy/config.ex @@ -1,6 +1,6 @@ -defmodule Admin.Kaffy.Config do +defmodule Legendary.Admin.Kaffy.Config do def create_resources(_conn) do - config = Application.get_env(:admin, Admin) + config = Application.get_env(:admin, Legendary.Admin) {resources, _} = Keyword.pop(config, :resources, []) diff --git a/apps/admin/lib/kaffy/editor_extension.ex b/apps/admin/lib/kaffy/editor_extension.ex index ff65b150..bf0d0b5d 100644 --- a/apps/admin/lib/kaffy/editor_extension.ex +++ b/apps/admin/lib/kaffy/editor_extension.ex @@ -1,4 +1,4 @@ -defmodule Admin.Kaffy.EditorExtension do +defmodule Legendary.Admin.Kaffy.EditorExtension do def stylesheets(_conn) do [ {:safe, ~s()}, diff --git a/apps/admin/mix.exs b/apps/admin/mix.exs index 7bc29e75..380e63fe 100644 --- a/apps/admin/mix.exs +++ b/apps/admin/mix.exs @@ -1,4 +1,4 @@ -defmodule Admin.MixProject do +defmodule Legendary.Admin.MixProject do use Mix.Project def project do @@ -25,7 +25,7 @@ defmodule Admin.MixProject do # Type `mix help compile.app` for more information. def application do [ - mod: {Admin.Application, []}, + mod: {Legendary.Admin.Application, []}, extra_applications: [:logger, :runtime_tools] ] end diff --git a/apps/admin/priv/repo/seeds.exs b/apps/admin/priv/repo/seeds.exs index f67a3785..88c37a1b 100644 --- a/apps/admin/priv/repo/seeds.exs +++ b/apps/admin/priv/repo/seeds.exs @@ -5,7 +5,7 @@ # Inside the script, you can read and write to any of your # repositories directly: # -# Content.Repo.insert!(%Content.SomeSchema{}) +# Legendary.Content.Repo.insert!(%Legendary.Content.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fail if something goes wrong. diff --git a/apps/admin/test/admin/controllers/page_controller_test.exs b/apps/admin/test/admin/controllers/page_controller_test.exs index a81e3a75..93bbe035 100644 --- a/apps/admin/test/admin/controllers/page_controller_test.exs +++ b/apps/admin/test/admin/controllers/page_controller_test.exs @@ -1,3 +1,3 @@ -defmodule Admin.PageControllerTest do - use Admin.ConnCase +defmodule Legendary.Admin.PageControllerTest do + use Legendary.Admin.ConnCase end diff --git a/apps/admin/test/admin/views/error_helpers_test.exs b/apps/admin/test/admin/views/error_helpers_test.exs index dccc29bf..e7a35d7d 100644 --- a/apps/admin/test/admin/views/error_helpers_test.exs +++ b/apps/admin/test/admin/views/error_helpers_test.exs @@ -1,10 +1,10 @@ -defmodule Admin.ErrorHelpersTest do - use Admin.ConnCase +defmodule Legendary.Admin.ErrorHelpersTest do + use Legendary.Admin.ConnCase import Phoenix.HTML, only: [safe_to_string: 1] import Phoenix.HTML.Form, only: [form_for: 3] - import Admin.ErrorHelpers + import Legendary.Admin.ErrorHelpers def form do :example diff --git a/apps/admin/test/admin/views/error_view_test.exs b/apps/admin/test/admin/views/error_view_test.exs index 8d101c57..cc64fb34 100644 --- a/apps/admin/test/admin/views/error_view_test.exs +++ b/apps/admin/test/admin/views/error_view_test.exs @@ -1,14 +1,14 @@ -defmodule Admin.ErrorViewTest do - use Admin.ConnCase, async: true +defmodule Legendary.Admin.ErrorViewTest do + use Legendary.Admin.ConnCase, async: true # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View test "renders 404.html" do - assert render_to_string(Admin.ErrorView, "404.html", []) == "Not Found" + assert render_to_string(Legendary.Admin.ErrorView, "404.html", []) == "Not Found" end test "renders 500.html" do - assert render_to_string(Admin.ErrorView, "500.html", []) == "Internal Server Error" + assert render_to_string(Legendary.Admin.ErrorView, "500.html", []) == "Internal Server Error" end end diff --git a/apps/admin/test/admin/views/layout_view_test.exs b/apps/admin/test/admin/views/layout_view_test.exs index 37b6b079..186b83f7 100644 --- a/apps/admin/test/admin/views/layout_view_test.exs +++ b/apps/admin/test/admin/views/layout_view_test.exs @@ -1,5 +1,5 @@ -defmodule Admin.LayoutViewTest do - use Admin.ConnCase, async: true +defmodule Legendary.Admin.LayoutViewTest do + use Legendary.Admin.ConnCase, async: true # When testing helpers, you may want to import Phoenix.HTML and # use functions such as safe_to_string() to convert the helper diff --git a/apps/admin/test/admin/views/page_view_test.exs b/apps/admin/test/admin/views/page_view_test.exs index 85ce0a3d..53568cf6 100644 --- a/apps/admin/test/admin/views/page_view_test.exs +++ b/apps/admin/test/admin/views/page_view_test.exs @@ -1,3 +1,3 @@ -defmodule Admin.PageViewTest do - use Admin.ConnCase, async: true +defmodule Legendary.Admin.PageViewTest do + use Legendary.Admin.ConnCase, async: true end diff --git a/apps/admin/test/support/channel_case.ex b/apps/admin/test/support/channel_case.ex index 57fe6cf2..2fa05231 100644 --- a/apps/admin/test/support/channel_case.ex +++ b/apps/admin/test/support/channel_case.ex @@ -1,4 +1,4 @@ -defmodule Admin.ChannelCase do +defmodule Legendary.Admin.ChannelCase do @moduledoc """ This module defines the test case to be used by channel tests. @@ -11,7 +11,7 @@ defmodule Admin.ChannelCase do we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously - by setting `use Admin.ChannelCase, async: true`, although + by setting `use Legendary.Admin.ChannelCase, async: true`, although this option is not recommended for other databases. """ @@ -21,18 +21,18 @@ defmodule Admin.ChannelCase do quote do # Import conveniences for testing with channels import Phoenix.ChannelTest - import Admin.ChannelCase + import Legendary.Admin.ChannelCase # The default endpoint for testing - @endpoint Admin.Endpoint + @endpoint Legendary.Admin.Endpoint end end setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Admin.Repo) + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Legendary.Admin.Repo) unless tags[:async] do - Ecto.Adapters.SQL.Sandbox.mode(Admin.Repo, {:shared, self()}) + Ecto.Adapters.SQL.Sandbox.mode(Legendary.Admin.Repo, {:shared, self()}) end :ok diff --git a/apps/admin/test/support/conn_case.ex b/apps/admin/test/support/conn_case.ex index 073cd711..3a07db3d 100644 --- a/apps/admin/test/support/conn_case.ex +++ b/apps/admin/test/support/conn_case.ex @@ -1,4 +1,4 @@ -defmodule Admin.ConnCase do +defmodule Legendary.Admin.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. @@ -11,7 +11,7 @@ defmodule Admin.ConnCase do we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously - by setting `use Admin.ConnCase, async: true`, although + by setting `use Legendary.Admin.ConnCase, async: true`, although this option is not recommended for other databases. """ @@ -22,20 +22,20 @@ defmodule Admin.ConnCase do # Import conveniences for testing with connections import Plug.Conn import Phoenix.ConnTest - import Admin.ConnCase + import Legendary.Admin.ConnCase - alias Admin.Router.Helpers, as: Routes + alias Legendary.Admin.Router.Helpers, as: Routes # The default endpoint for testing - @endpoint Admin.Endpoint + @endpoint Legendary.Admin.Endpoint end end setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Admin.Repo) + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Legendary.Admin.Repo) unless tags[:async] do - Ecto.Adapters.SQL.Sandbox.mode(Admin.Repo, {:shared, self()}) + Ecto.Adapters.SQL.Sandbox.mode(Legendary.Admin.Repo, {:shared, self()}) end {:ok, conn: Phoenix.ConnTest.build_conn()} diff --git a/apps/admin/test/test_helper.exs b/apps/admin/test/test_helper.exs index 1a2391ba..f7a06b43 100644 --- a/apps/admin/test/test_helper.exs +++ b/apps/admin/test/test_helper.exs @@ -1,2 +1,2 @@ ExUnit.start() -Ecto.Adapters.SQL.Sandbox.mode(Admin.Repo, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Legendary.Admin.Repo, :manual) diff --git a/apps/app/lib/app_web.ex b/apps/app/lib/app_web.ex index 6814d321..808a9ccf 100644 --- a/apps/app/lib/app_web.ex +++ b/apps/app/lib/app_web.ex @@ -66,7 +66,7 @@ defmodule AppWeb do # Import basic rendering functionality (render, render_layout, etc) import Phoenix.View - import CoreWeb.Helpers + import Legendary.CoreWeb.Helpers import AppWeb.ErrorHelpers import AppWeb.Gettext alias AppWeb.Router.Helpers, as: Routes diff --git a/apps/app/lib/app_web/router.ex b/apps/app/lib/app_web/router.ex index 347991bb..0f01a0a4 100644 --- a/apps/app/lib/app_web/router.ex +++ b/apps/app/lib/app_web/router.ex @@ -4,7 +4,7 @@ defmodule AppWeb.Router do use Pow.Extension.Phoenix.Router, extensions: [PowResetPassword, PowEmailConfirmation] - alias AuthWeb.Plugs.{RequireAdmin} + alias Legendary.AuthWeb.Plugs.{RequireAdmin} pipeline :browser do plug :accepts, ["html"] @@ -57,6 +57,6 @@ defmodule AppWeb.Router do pow_extension_routes() end - use Admin.Routes - use Content.Routes + use Legendary.Admin.Routes + use Legendary.Content.Routes end diff --git a/apps/app/lib/app_web/templates/layout/_menu.html.eex b/apps/app/lib/app_web/templates/layout/_menu.html.eex index fc098bf6..cbfd3386 100644 --- a/apps/app/lib/app_web/templates/layout/_menu.html.eex +++ b/apps/app/lib/app_web/templates/layout/_menu.html.eex @@ -1,7 +1,7 @@