Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update phoenix to 1.5.x #460

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ config :ret, RetWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "txlMOtlaY5x3crvOCko4uV5PM29ul3zGo1oBGNO3cDXx+7GHLKqt0gR9qzgThxb5",
render_errors: [view: RetWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: Ret.PubSub, adapter: Phoenix.PubSub.PG2]
pubsub_server: Ret.PubSub

# Configures Elixir's Logger
config :logger, :console,
Expand Down
2 changes: 1 addition & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ config :ret, RetWeb.Endpoint,
assets_url: [scheme: "https", host: "", port: 443],
link_url: [scheme: "https", host: "", port: 443],
imgproxy_url: [scheme: "http", host: "", port: 5000],
pubsub: [name: Ret.PubSub, adapter: Phoenix.PubSub.PG2, pool_size: 4],
pubsub_server: Ret.PubSub,
server: true,
root: "."

Expand Down
3 changes: 3 additions & 0 deletions lib/ret/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ defmodule Ret.Application do

# Define workers and child supervisors to be supervised
children = [
# Start the PubSub system
{Phoenix.PubSub, [name: Ret.PubSub, adapter: Phoenix.PubSub.PG2, pool_size: 4]},

# Start the Ecto repository
supervisor(Ret.Repo, []),
supervisor(RetWeb.Endpoint, []),
Expand Down
2 changes: 1 addition & 1 deletion lib/ret_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule RetWeb do
namespace: RetWeb

# Import convenience functions from controllers
import Phoenix.Controller, only: [get_flash: 2, view_module: 1]
import Phoenix.Controller, only: [get_flash: 2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is called out specifically to check in the TODOs but I don't see any mention of this in the upgrade notes. Whats this change do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes it so that Phoenix.Controller.view_module/1 is not automatically accessible from all the views (modules with use RetWeb, :view).

First I made the changes as per this line source:

[Layout] Use <%= @inner_content %> instead of <%= render @view_module, @view_template, assigns %> for rendering the child layout

Then I noticed that view_module was never used anywhere else in the project. I figured it was safe (and maybe desirable) for us to remove it, but I don't feel strongly about it.


# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
Expand Down
2 changes: 1 addition & 1 deletion lib/ret_web/templates/layout/app.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</div>
</div>
<div class="container">
<%= render @view_module, @view_template, assigns %>
<%= @inner_content %>
</div>
</div>
<div class="container">
Expand Down
15 changes: 7 additions & 8 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Ret.Mixfile do
[
app: :ret,
version: System.get_env("RELEASE_VERSION") || "1.0.0",
elixir: "~> 1.4",
elixir: "~> 1.8",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
Expand Down Expand Up @@ -34,23 +34,22 @@ defmodule Ret.Mixfile do
defp deps do
[
{:ecto_boot_migration, "~> 0.2.0"},
{:phoenix, "~> 1.4.0"},
{:phoenix_pubsub, "~> 1.1"},
{:phoenix, "~> 1.5.0"},
{:phoenix_pubsub, "~> 2.0"},
{:phoenix_ecto, "~> 4.0"},
{:plug, "~> 1.7"},
# Avoid 3.4.0 for now bc https://github.com/elixir-ecto/ecto/issues/3246
{:ecto, "~> 3.3.0"},
{:ecto_sql, "~> 3.3.0"},
{:absinthe, "~> 1.4"},
{:absinthe, "~> 1.5.0"},
{:dataloader, "~> 1.0.0"},
{:absinthe_plug, "~> 1.4"},
{:absinthe_phoenix, "~> 1.4.0"},
{:absinthe_plug, "~> 1.5.0"},
{:absinthe_phoenix, "~> 2.0.0"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.13"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:gettext, "~> 0.17"},
{:cowboy, "~> 2.6.3"},
{:plug_cowboy, "~> 2.0"},
{:plug_cowboy, "~> 2.1"},
{:distillery, "~> 2.0"},
{:peerage, "~> 1.0"},
{:httpoison, "~> 1.5"},
Expand Down
26 changes: 14 additions & 12 deletions mix.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/support/channel_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule RetWeb.ChannelCase do
using do
quote do
# Import conveniences for testing with channels
use Phoenix.ChannelTest
import Phoenix.ChannelTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upgrade guide says to replace use Phoenix.ConnTest with

import Plug.Conn
import Phoenix.ConnTest

Do we need to import Conn as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so -- the note for ChannelTest only suggests replacing use with import:

[ChannelTest] use Phoenix.ChannelTest is deprecated in favor of import Phoenix.ChannelTest
[ConnTest] use Phoenix.ConnTest is deprecated in favor of import Plug.Conn; import Phoenix.ConnTest

source


# The default endpoint for testing
@endpoint RetWeb.Endpoint
Expand Down
3 changes: 2 additions & 1 deletion test/support/conn_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ defmodule RetWeb.ConnCase do
using do
quote do
# Import conveniences for testing with connections
use Phoenix.ConnTest
import Plug.Conn
import Phoenix.ConnTest
import RetWeb.Router.Helpers

# The default endpoint for testing
Expand Down