Repository: phoenixframework/phoenix
Pull request #3775 (2020-04-20 04:41:25)

Fix smal typo


Patch:
diff --git a/guides/deployment/heroku.md b/guides/deployment/heroku.md
index be9279ebd..9a20bb9d8 100644
--- a/guides/deployment/heroku.md
+++ b/guides/deployment/heroku.md
@@ -352,7 +352,7 @@ build:
 
 ### Setup releases and Dockerfile
 
-Now we need to define a `Dockerfile` at the root folder of your project that contains your application. We recommend to use releases when doing so, as the release will allow us to build a container with only the parts of Erlang and Elixir we actually use. Follow [the releases docs](/releases.html). At the end of the guide, there is a sample Dockerfile file you can use.
+Now we need to define a `Dockerfile` at the root folder of your project that contains your application. We recommend to use releases when doing so, as the release will allow us to build a container with only the parts of Erlang and Elixir we actually use. Follow [the releases docs](releases.html). At the end of the guide, there is a sample Dockerfile file you can use.
 
 Once you have the image definition setup, you can push your app to heroku and you can see it starts building the image and deploy it.
 
diff --git a/installer/templates/phx_umbrella/apps/app_name_web/mix.exs b/installer/templates/phx_umbrella/apps/app_name_web/mix.exs
index 804aa3c4c..ea26fd1ce 100644
--- a/installer/templates/phx_umbrella/apps/app_name_web/mix.exs
+++ b/installer/templates/phx_umbrella/apps/app_name_web/mix.exs
@@ -40,10 +40,10 @@ defmodule <%= web_namespace %>.MixProject do
       <%= phoenix_dep %>,<%= if ecto do %>
       {:phoenix_ecto, "~> 4.0"},<% end %><%= if html do %><%= if live do %>
       {:phoenix_live_view, "~> 0.12.0"},
-      {:floki, ">= 0.0.0", only: :test},<% end %><%= if dashboard do %>
-      {:phoenix_live_dashboard, "~> 0.1.0"},<% end %>
+      {:floki, ">= 0.0.0", only: :test},<% end %>
       {:phoenix_html, "~> 2.11"},
-      {:phoenix_live_reload, "~> 1.2", only: :dev},<% end %>
+      {:phoenix_live_reload, "~> 1.2", only: :dev},<% end %><%= if dashboard do %>
+      {:phoenix_live_dashboard, "~> 0.1.0"},<% end %>
       {:telemetry_metrics, "~> 0.4"},
       {:telemetry_poller, "~> 0.4"},<%= if gettext do %>
       {:gettext, "~> 0.11"},<% end %><%= if app_name != web_app_name do %>
diff --git a/lib/mix/tasks/phx.gen.live.ex b/lib/mix/tasks/phx.gen.live.ex
index 8793578b5..f6e71c094 100644
--- a/lib/mix/tasks/phx.gen.live.ex
+++ b/lib/mix/tasks/phx.gen.live.ex
@@ -173,7 +173,7 @@ defmodule Mix.Tasks.Phx.Gen.Live do
 
       Could not find Phoenix.LiveView.Helpers imported in #{file_path}.
 
-      This is typically happens because your application was not generated
+      This typically happens because your application was not generated
       with the --live flag:
 
           mix phx.new my_app --live
diff --git a/lib/phoenix/logger.ex b/lib/phoenix/logger.ex
index 12be1a03a..81521ee06 100644
--- a/lib/phoenix/logger.ex
+++ b/lib/phoenix/logger.ex
@@ -281,7 +281,7 @@ defmodule Phoenix.Logger do
 
   ## Event: [:phoenix, :channel_joined]
 
-  def phoenix_channel_joined(_, %{duration: duration}, %{socket: socket} = metadata, _) do
+  defp phoenix_channel_joined(_, %{duration: duration}, %{socket: socket} = metadata, _) do
     channel_log(:log_join, socket, fn ->
       %{result: result, params: params} = metadata
 
@@ -301,7 +301,7 @@ defmodule Phoenix.Logger do
 
   ## Event: [:phoenix, :channel_handle_in]
 
-  def phoenix_channel_handled_in(_, %{duration: duration}, %{socket: socket} = metadata, _) do
+  defp phoenix_channel_handled_in(_, %{duration: duration}, %{socket: socket} = metadata, _) do
     channel_log(:log_handle_in, socket, fn ->
       %{event: event, params: params} = metadata
 


Test patch:
diff --git a/installer/test/phx_new_umbrella_test.exs b/installer/test/phx_new_umbrella_test.exs
index 7fe4d38e0..57b6e8baa 100644
--- a/installer/test/phx_new_umbrella_test.exs
+++ b/installer/test/phx_new_umbrella_test.exs
@@ -301,6 +301,46 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
     end
   end
 
+  test "new with no_dashboard" do
+    in_tmp "new with no_dashboard", fn ->
+      Mix.Tasks.Phx.New.run([@app, "--umbrella", "--no-dashboard"])
+
+      assert_file web_path(@app, "mix.exs"), &refute(&1 =~ ~r":phoenix_live_dashboard")
+
+      assert_file web_path(@app, "lib/#{@app}_web/templates/layout/app.html.eex"), fn file ->
+        refute file =~ ~s|<%= link "LiveDashboard", to: Routes.live_dashboard_path(@conn, :home)|
+      end
+
+      assert_file web_path(@app, "lib/#{@app}_web/endpoint.ex"), fn file ->
+        assert file =~ ~s|defmodule PhxUmbWeb.Endpoint|
+        refute file =~ ~s|socket "/live"|
+        refute file =~ ~s|plug Phoenix.LiveDashboard.RequestLogger|
+      end
+    end
+  end
+
+  test "new with no_html" do
+    in_tmp "new with no_html", fn ->
+      Mix.Tasks.Phx.New.run([@app, "--umbrella", "--no-html"])
+
+      assert_file web_path(@app, "mix.exs"), fn file ->
+        refute file =~ ~s|:phoenix_live_view|
+        assert file =~ ~s|:phoenix_live_dashboard|
+      end
+
+      assert_file web_path(@app, "lib/#{@app}_web/endpoint.ex"), fn file ->
+        assert file =~ ~s|defmodule PhxUmbWeb.Endpoint|
+        assert file =~ ~s|socket "/live"|
+        assert file =~ ~s|plug Phoenix.LiveDashboard.RequestLogger|
+      end
+
+      assert_file web_path(@app, "lib/#{@app}_web/router.ex"), fn file ->
+        refute file =~ ~s|pipeline :browser|
+        assert file =~ ~s|pipe_through [:fetch_session, :protect_from_forgery]|
+      end
+    end
+  end
+
   test "new with no_webpack" do
     in_tmp "new with no_webpack", fn ->
       Mix.Tasks.Phx.New.run([@app, "--umbrella", "--no-webpack"])
@@ -324,6 +364,24 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
     end
   end
 
+  test "new with live no_dashboard" do
+    in_tmp "new with live no_dashboard", fn ->
+      Mix.Tasks.Phx.New.run([@app, "--umbrella", "--live", "--no-dashboard"])
+
+      assert_file web_path(@app, "mix.exs"), &refute(&1 =~ ~r":phoenix_live_dashboard")
+
+      assert_file web_path(@app, "lib/#{@app}_web/templates/layout/root.html.leex"), fn file ->
+        refute file =~ ~s|<%= link "LiveDashboard", to: Routes.live_dashboard_path(@conn, :home)|
+      end
+
+      assert_file web_path(@app, "lib/#{@app}_web/endpoint.ex"), fn file ->
+        assert file =~ ~s|defmodule PhxUmbWeb.Endpoint|
+        assert file =~ ~s|socket "/live"|
+        refute file =~ ~s|plug Phoenix.LiveDashboard.RequestLogger|
+      end
+    end
+  end
+
   test "new with live" do
     in_tmp "new with live", fn ->
       Mix.Tasks.Phx.New.run([@app, "--umbrella", "--live"])