Skip to content

Commit 6039e75

Browse files
committed
Remove deprecations and up requirements
New minimum: - Elixir 1.7 - Ecto 3.0 - Phoenix 1.4
1 parent c46cf4c commit 6039e75

File tree

17 files changed

+28
-303
lines changed

17 files changed

+28
-303
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ env:
33
- MIX_ENV=test
44
matrix:
55
include:
6-
- elixir: 1.6
6+
- elixir: 1.7
77
otp_release: 20.0
88
- elixir: 1.8
99
otp_release: 21.0

CHANGELOG.md

Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,20 @@
11
# Changelog
22

3-
## v1.0.5 (TBA)
4-
5-
* Added `extension_messages/1` to extension controllers and callbacks
6-
* Improved feedback for when no templates are generated for an extension with `mix pow.extension.phoenix.gen.templates` and `mix pow.extension.phoenix.mailer.gen.templates` tasks
7-
* Deprecated `Pow.Extension.Ecto.Context.Base`
8-
9-
## v1.0.4 (2019-03-13)
10-
11-
* Added `PowInvitation` to the `mix pow.extension.phoenix.gen.templates` and `mix pow.extension.phoenix.mailer.gen.templates` tasks
12-
* Fixed issue in umbrella projects where extensions wasn't found in environment configuration
13-
* Fixed so `:namespace` environment config can be used as web app module name
14-
* Shell instructions will only be printed if the configuration is missing
15-
* Now requires that `:ecto` or `:phoenix` are included in the dependency list for the app to run respective mix tasks
16-
* Deprecated `Mix.Pow.context_app/0`
17-
* Deprecated `Mix.Pow.ensure_dep!/3`
18-
* Deprecated `Mix.Pow.context_base/1`
19-
20-
## v1.0.3 (2019-03-09)
3+
## v1.1.0 (TBA)
214

225
### Changes
236

24-
* Added `PowInvitation` extension
25-
* Added support in `Pow.Ecto.Schema` for Ecto associations fields
26-
* Added support for adding custom methods with `Pow.Extension.Ecto.Schema` through `__using__/1` macro in extension ecto schema module
27-
* Help information raised with invalid schema arguments for `pow.install`, `pow.ecto.install`, `pow.ecto.gen.migration`, and `pow.ecto.gen.schema` mix tasks
28-
* `PowEmailConfirmation` now redirects unconfirmed users to `after_registration_path/1` or `after_sign_in_path/1` rather than `pow_session_path(conn, :new)`
29-
30-
### Bug fixes
31-
32-
* Correct shell instructions for `mix pow.install` task with custom schema
33-
* Fixed bug in `Pow.Extension.Phoenix.Router.Base` and `Pow.Extension.Phoenix.Messages` where the full extension name wasn't used to namespace methods
7+
- Requires Elixir 1.7 or higher
8+
- Requires Ecto 3.0 or higher
9+
- Requires Phoenix 1.4 or higher
3410

3511
### Deprecations
3612

37-
* Deprecated `Pow.Extension.Config.underscore_extension/1`
38-
* Deprecated `PowResetPassword.Ecto.Context.password_changeset/2`
39-
* Deprecated `Pow.Ecto.Schema.filter_new_fields/2`
40-
* Deprecated `:messages_backend_fallback` setting for extension controllers
41-
* Removed deprecated macro `router_helpers/1` in `Pow.Phoenix.Controller`
42-
43-
## v1.0.2 (2019-02-28)
44-
45-
* Added flash error message about e-mail confirmation for when user changes e-mail with PowEmailConfirmation enabled
46-
* Added `new_password_changeset/3` and `confirm_password_changeset/3` to `Pow.Ecto.Schema.Changeset`
47-
* Redis cache store backend guide
48-
* Correct shell instructions for `mix pow.phoenix.gen.templates` task
49-
* Only load environment config in `Pow.Config.get/3` when no key is set in the provided config
50-
* Fixed issue in `Pow.Store.Backend.MnesiaCache.keys/1` and `Pow.Store.Backend.EtsCache.keys/1` so they now return keys without namespace
51-
* `Pow.Store.Backend.MnesiaCache.put/3` now raises an error if TTL is not provided
52-
53-
### Breaking changes
54-
55-
* `PowResetPassword.Plug.reset_password_token/1` has been removed
56-
57-
## v1.0.1 (2019-01-27)
58-
59-
* `pow.extension.ecto.gen.migrations` mix task will output warning when a migration file won't be generated for any particular extension
60-
* Leading and trailing whitespace is removed from the user id field value (in addition to forced lower case)
61-
* An exception is raised when `pow_routes/0` or `pow_extension_routes/0` are used inside router scopes with aliases
62-
* Mail view templates assigns now has `[user: user, conn: conn]` along with the template specific assigns
63-
* Mail view subject methods now gets the same assigns passed as mail view template assigns instead of only `[conn: conn]`
64-
* Added `pow_registration_routes/0`, `pow_session_routes/0` and `pow_scope/1` macros to the router module
65-
* Added guide on how to disable registration
66-
67-
## v1.0.0 (2018-11-18)
68-
69-
* Phoenix 1.4 support
70-
* Ecto 3.0 support
13+
- Removed deprecated method `PowResetPassword.Ecto.Context.password_changeset/2`
14+
- Removed deprecated method `Pow.Extension.Config.underscore_extension/1`
15+
- Removed deprecated method `Mix.Pow.context_app/0`
16+
- Removed deprecated method `Mix.Pow.ensure_dep!/3`
17+
- Removed deprecated method `Mix.Pow.context_base/1`
18+
- Config fallback set with `:messages_backend_fallback` configuration option removed in `Pow.Extension.Phoenix.Controller.Base`
19+
- Removed deprecated Bootstrap support in `Pow.Phoenix.HTML.FormTemplate`
20+
- Removed deprecated module `Pow.Extension.Ecto.Context.Base`

lib/extensions/reset_password/ecto/context.ex

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,4 @@ defmodule PowResetPassword.Ecto.Context do
1212
|> Schema.reset_password_changeset(params)
1313
|> Context.do_update(config)
1414
end
15-
16-
# TODO: Remove by 1.1.0
17-
@deprecated "Use `PowResetPassword.Ecto.Schema.reset_password_changeset/2` instead"
18-
def password_changeset(user, params), do: Schema.reset_password_changeset(user, params)
1915
end

lib/mix/pow.ex

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,6 @@ defmodule Mix.Pow do
1616
:ok
1717
end
1818

19-
# TODO: Remove by 1.1.0
20-
@doc false
21-
@deprecated "Use `ensure_ecto!` or `ensure_phoenix!` instead"
22-
@spec ensure_dep!(binary(), atom(), OptionParser.argv()) :: :ok | no_return
23-
def ensure_dep!(task, dep, _args) do
24-
fetch_deps()
25-
|> top_level_dep_in_deps?(dep)
26-
|> case do
27-
true ->
28-
:ok
29-
30-
false ->
31-
Mix.raise("mix #{task} can only be run inside an application directory that has #{inspect dep} as dependency")
32-
end
33-
end
34-
3519
@doc """
3620
Raises an exception if application doesn't have Ecto as dependency.
3721
"""
@@ -53,15 +37,7 @@ defmodule Mix.Pow do
5337
end)
5438
end
5539

56-
# TODO: Remove by 1.1.0 and only support Elixir 1.7
57-
defp fetch_deps do
58-
System.version()
59-
|> Version.match?("~> 1.6.0")
60-
|> case do
61-
true -> apply(Dep, :loaded, [[]])
62-
false -> apply(Dep, :load_on_environment, [[]])
63-
end
64-
end
40+
defp fetch_deps, do: Dep.load_on_environment([])
6541

6642
@doc """
6743
Raises an exception if application doesn't have Phoenix as dependency.
@@ -147,36 +123,12 @@ defmodule Mix.Pow do
147123
""")
148124
end
149125

150-
# TODO: Remove by 1.1.0
151-
@doc false
152-
@deprecated "Please use `Pow.Phoenix.parse_structure/1` instead"
153-
@spec context_app :: atom() | no_return
154-
def context_app do
155-
this_app = otp_app()
156-
157-
this_app
158-
|> Application.get_env(:generators, [])
159-
|> Keyword.get(:context_app)
160-
|> case do
161-
nil -> this_app
162-
false -> Mix.raise("No context_app configured for current application")
163-
{app, _path} -> app
164-
app -> app
165-
end
166-
end
167-
168126
@doc false
169127
@spec otp_app :: atom() | no_return
170128
def otp_app do
171129
Keyword.fetch!(Mix.Project.config(), :app)
172130
end
173131

174-
# TODO: Remove by 1.1.0
175-
@doc false
176-
@deprecated "Use `app_base/1` instead"
177-
@spec context_base(atom()) :: atom()
178-
def context_base(app), do: app_base(app)
179-
180132
@doc """
181133
Fetches the context base module for the app.
182134
"""

lib/mix/pow/ecto/migration.ex

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Mix.Pow.Ecto.Migration do
22
@moduledoc """
33
Utilities module for ecto migrations in mix tasks.
44
"""
5-
alias Mix.Generator
5+
alias Mix.{EctoSQL, Generator}
66

77
@doc """
88
Creates a migration file for the repo.
@@ -12,7 +12,7 @@ defmodule Mix.Pow.Ecto.Migration do
1212
base_name = "#{Macro.underscore(name)}.exs"
1313
path =
1414
repo
15-
|> source_repo_priv()
15+
|> EctoSQL.source_repo_priv()
1616
|> Path.join("migrations")
1717
|> maybe_create_directory()
1818
timestamp = timestamp(path)
@@ -63,14 +63,4 @@ defmodule Mix.Pow.Ecto.Migration do
6363

6464
defp pad(i) when i < 10, do: <<?0, ?0 + i>>
6565
defp pad(i), do: to_string(i)
66-
67-
# TODO: Remove by 1.1.0 and only use Ecto 3.0
68-
defp source_repo_priv(repo) do
69-
mod =
70-
if Pow.dependency_vsn_match?(:ecto, "< 3.0.0"),
71-
do: Mix.Ecto,
72-
else: Mix.EctoSQL
73-
74-
mod.source_repo_priv(repo)
75-
end
7666
end

lib/pow.ex

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
11
defmodule Pow do
22
@moduledoc false
3-
4-
@doc """
5-
Checks for version requirement in dependencies.
6-
"""
7-
@spec dependency_vsn_match?(atom(), binary()) :: boolean()
8-
def dependency_vsn_match?(dep, req) do
9-
case :application.get_key(dep, :vsn) do
10-
{:ok, actual} ->
11-
actual
12-
|> List.to_string()
13-
|> Version.match?(req)
14-
15-
_any ->
16-
false
17-
end
18-
end
193
end

lib/pow/ecto/schema.ex

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,6 @@ defmodule Pow.Ecto.Schema do
215215
Enum.filter(fields, &not Enum.member?(existing_fields, {elem(&1, 0), elem(&1, 1)}))
216216
end
217217

218-
# TODO: Remove by 1.1.0
219-
@deprecated "No longer public method"
220-
def filter_new_fields(fields, existing_fields), do: __filter_new_fields__(fields, existing_fields)
221-
222218
@doc false
223219
defmacro __register_fields__ do
224220
quote do

lib/pow/extension/config.ex

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,4 @@ defmodule Pow.Extension.Config do
2525
|> Enum.map(&Module.concat([&1] ++ module_list))
2626
|> Enum.filter(&Code.ensure_compiled?/1)
2727
end
28-
29-
# TODO: Remove by 1.1.0
30-
@doc """
31-
Returns a binary of the extension atom.
32-
33-
This is usually used to create extension namespaces for methods to be used
34-
in shared modules.
35-
"""
36-
@deprecated "Create the namespace directly in your module"
37-
@spec underscore_extension(atom()) :: binary()
38-
def underscore_extension(extension) do
39-
extension
40-
|> Module.split()
41-
|> List.first()
42-
|> Macro.underscore()
43-
end
4428
end

lib/pow/extension/ecto/context/base.ex

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/pow/extension/phoenix/controllers/controller/base.ex

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ defmodule Pow.Extension.Phoenix.Controller.Base do
1010
# ...
1111
end
1212
"""
13-
alias Pow.{Config, Phoenix.Controller}
13+
alias Pow.Phoenix.Controller
1414

1515
@doc false
1616
defmacro __using__(config) do
1717
quote do
1818
use Controller, unquote(config)
1919

20-
unquote(__MODULE__).__define_helper_methods__(unquote(config))
20+
unquote(__MODULE__).__define_helper_methods__()
2121
end
2222
end
2323

2424
@doc false
25-
defmacro __define_helper_methods__(config) do
25+
defmacro __define_helper_methods__() do
2626
quote do
27-
@messages_fallback unquote(__MODULE__).__messages_fallback__(unquote(config), __MODULE__, __ENV__)
27+
@messages_fallback unquote(__MODULE__).__messages_fallback__(__MODULE__)
2828

2929
@doc false
3030
def extension_messages(conn), do: unquote(__MODULE__).__messages_module__(conn, @messages_fallback)
@@ -51,17 +51,4 @@ defmodule Pow.Extension.Phoenix.Controller.Base do
5151
|> Enum.reverse()
5252
|> Module.concat()
5353
end
54-
55-
# TODO: Remove config fallback by 1.1.0
56-
def __messages_fallback__(config, module, env) do
57-
case Config.get(config, :messages_backend_fallback) do
58-
nil ->
59-
__messages_fallback__(module)
60-
61-
module ->
62-
IO.warn("Passing `:messages_backend_fallback` is deprecated", Macro.Env.stacktrace(env))
63-
64-
module
65-
end
66-
end
6754
end

lib/pow/extension/phoenix/controllers/controller_callbacks/base.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ defmodule Pow.Extension.Phoenix.ControllerCallbacks.Base do
1919
@callback before_respond(atom(), atom(), any(), Config.t()) :: any()
2020

2121
@doc false
22-
defmacro __using__(config) do
22+
defmacro __using__(_config) do
2323
quote do
2424
@behaviour unquote(__MODULE__)
2525

2626
require Base
2727
require Controller
2828

29-
Base.__define_helper_methods__(unquote(config))
29+
Base.__define_helper_methods__()
3030
Controller.__define_helper_methods__()
3131

3232
@before_compile unquote(__MODULE__)

lib/pow/phoenix/html/bootstrap.ex

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)