Repository: phoenixframework/phoenix
Pull request #5646 (2023-11-22 00:11:19)

Apply consistent indentation in Heex template example


Patch:
diff --git a/guides/contexts.md b/guides/contexts.md
index 61b76aad0..e315fa718 100644
--- a/guides/contexts.md
+++ b/guides/contexts.md
@@ -914,7 +914,7 @@ defmodule HelloWeb.CartController do
 end
 ```
 
-We defined a new cart controller to handle the `get "/cart"` route. For showing a cart, we render a `"show.html"` template which we'll create in moment. We know we need to allow the cart items to be changed by quantity updates, so right away we know we'll need a cart changeset. Fortunately, the context generator included a `ShoppingCart.change_cart/1` function, which we'll use. We pass it our cart struct which is already in the connection assigns thanks to the `fetch_current_cart` plug we defined in the router.
+We defined a new cart controller to handle the `get "/cart"` route. For showing a cart, we render a `"show.html"` template which we'll create in a moment. We know we need to allow the cart items to be changed by quantity updates, so right away we know we'll need a cart changeset. Fortunately, the context generator included a `ShoppingCart.change_cart/1` function, which we'll use. We pass it our cart struct which is already in the connection assigns thanks to the `fetch_current_cart` plug we defined in the router.
 
 Next, we can implement the view and template. Create a new view file at `lib/hello_web/controllers/cart_html.ex` with the following content:
 
@@ -936,10 +936,10 @@ Next we can create the template at `lib/hello_web/controllers/cart_html/show.htm
 
 ```heex
 <%= if @cart.items == [] do %>
-<.header>
-  My Cart
-  <:subtitle>Your cart is empty</:subtitle>
-</.header>
+  <.header>
+    My Cart
+    <:subtitle>Your cart is empty</:subtitle>
+  </.header>
 <% else %>
   <.header>
     My Cart
diff --git a/installer/templates/phx_web/components/core_components.ex b/installer/templates/phx_web/components/core_components.ex
index 6f7d48c67..6d5841ea4 100644
--- a/installer/templates/phx_web/components/core_components.ex
+++ b/installer/templates/phx_web/components/core_components.ex
@@ -580,8 +580,8 @@ defmodule <%= @web_namespace %>.CoreComponents do
   You can customize the size and colors of the icons by setting
   width, height, and background color classes.
 
-  Icons are extracted from your `assets/vendor/heroicons` directory and bundled
-  within your compiled app.css by the plugin in your `assets/tailwind.config.js`.
+  Icons are extracted from the `deps/heroicons` directory and bundled within
+  your compiled app.css by the plugin in your `assets/tailwind.config.js`.
 
   ## Examples
 
diff --git a/lib/mix/tasks/phx.gen.release.ex b/lib/mix/tasks/phx.gen.release.ex
index ea87e2c5d..87f9c596c 100644
--- a/lib/mix/tasks/phx.gen.release.ex
+++ b/lib/mix/tasks/phx.gen.release.ex
@@ -107,9 +107,9 @@ defmodule Mix.Tasks.Phx.Gen.Release do
         _build/dev/rel/#{app}/bin/#{app}
     """)
 
-    if opts.ecto do
+    if opts.ecto and opts.socket_db_adaptor_installed do
       post_install_instructions("config/runtime.exs", ~r/ECTO_IPV6/, """
-      [warn] Conditional IPV6 support missing from runtime configuration.
+      [warn] Conditional IPv6 support missing from runtime configuration.
 
       Add the following to your config/runtime.exs:
 
@@ -149,6 +149,7 @@ defmodule Mix.Tasks.Phx.Gen.Release do
     |> OptionParser.parse!(strict: [ecto: :boolean, docker: :boolean])
     |> elem(0)
     |> Keyword.put_new_lazy(:ecto, &ecto_sql_installed?/0)
+    |> Keyword.put_new_lazy(:socket_db_adaptor_installed, &socket_db_adaptor_installed?/0)
     |> Keyword.put_new(:docker, false)
     |> Map.new()
   end
@@ -188,6 +189,12 @@ defmodule Mix.Tasks.Phx.Gen.Release do
 
   defp ecto_sql_installed?, do: Mix.Project.deps_paths() |> Map.has_key?(:ecto_sql)
 
+  defp socket_db_adaptor_installed? do
+    Mix.Project.deps_paths(depth: 1)
+    |> Map.take([:tds, :myxql, :postgrex])
+    |> map_size() > 0
+  end
+
   @debian "bullseye"
   defp elixir_and_debian_vsn(elixir_vsn, otp_vsn) do
     url =
diff --git a/priv/templates/phx.gen.live/core_components.ex b/priv/templates/phx.gen.live/core_components.ex
index 6f7d48c67..6d5841ea4 100644
--- a/priv/templates/phx.gen.live/core_components.ex
+++ b/priv/templates/phx.gen.live/core_components.ex
@@ -580,8 +580,8 @@ defmodule <%= @web_namespace %>.CoreComponents do
   You can customize the size and colors of the icons by setting
   width, height, and background color classes.
 
-  Icons are extracted from your `assets/vendor/heroicons` directory and bundled
-  within your compiled app.css by the plugin in your `assets/tailwind.config.js`.
+  Icons are extracted from the `deps/heroicons` directory and bundled within
+  your compiled app.css by the plugin in your `assets/tailwind.config.js`.
 
   ## Examples
 


Test patch:
diff --git a/priv/templates/phx.gen.auth/auth_test.exs b/priv/templates/phx.gen.auth/auth_test.exs
index ef8c12ee9..bafdfd6b7 100644
--- a/priv/templates/phx.gen.auth/auth_test.exs
+++ b/priv/templates/phx.gen.auth/auth_test.exs
@@ -117,7 +117,7 @@ defmodule <%= inspect auth_module %>Test do
     end
   end
 
-  describe "on_mount: mount_current_<%= schema.singular %>" do
+  describe "on_mount :mount_current_<%= schema.singular %>" do
     test "assigns current_<%= schema.singular %> based on a valid <%= schema.singular %>_token", %{conn: conn, <%= schema.singular %>: <%= schema.singular %>} do
       <%= schema.singular %>_token = <%= inspect context.alias %>.generate_<%= schema.singular %>_session_token(<%= schema.singular %>)
       session = conn |> put_session(:<%= schema.singular %>_token, <%= schema.singular %>_token) |> get_session()
@@ -148,7 +148,7 @@ defmodule <%= inspect auth_module %>Test do
     end
   end
 
-  describe "on_mount: ensure_authenticated" do
+  describe "on_mount :ensure_authenticated" do
     test "authenticates current_<%= schema.singular %> based on a valid <%= schema.singular %>_token", %{conn: conn, <%= schema.singular %>: <%= schema.singular %>} do
       <%= schema.singular %>_token = <%= inspect context.alias %>.generate_<%= schema.singular %>_session_token(<%= schema.singular %>)
       session = conn |> put_session(:<%= schema.singular %>_token, <%= schema.singular %>_token) |> get_session()
@@ -185,7 +185,7 @@ defmodule <%= inspect auth_module %>Test do
     end
   end
 
-  describe "on_mount: :redirect_if_<%= schema.singular %>_is_authenticated" do
+  describe "on_mount :redirect_if_<%= schema.singular %>_is_authenticated" do
     test "redirects if there is an authenticated  <%= schema.singular %> ", %{conn: conn, <%= schema.singular %>: <%= schema.singular %>} do
       <%= schema.singular %>_token = <%= inspect context.alias %>.generate_<%= schema.singular %>_session_token(<%= schema.singular %>)
       session = conn |> put_session(:<%= schema.singular %>_token, <%= schema.singular %>_token) |> get_session()