Skip to content

Commit

Permalink
Remove deprecated code (#580)
Browse files Browse the repository at this point in the history
What changed?
=============

We remove deprecated code. In particular, we remove:

1. `Bamboo.Mailer.parse_opts/2`. It's been deprecated since commit
   [584ec63] and people can use `build_config/2` instead.

2. `TaskSupervisorStrategy.child_spec/0`. That function raises an error
   to notify people that the supervisor is automatically started and
   there's no need for setting it up. That change was introduced in
   [28ca48a] and removed from documentation. I think that error can now
   be removeed.

[584ec63]: 584ec63
[28ca48a]: 28ca48a
  • Loading branch information
germsvel authored Feb 19, 2021
1 parent 54aa419 commit e43a28a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 25 deletions.
10 changes: 0 additions & 10 deletions lib/bamboo/mailer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,6 @@ defmodule Bamboo.Mailer do
Formatter.format_email_address(record, %{type: type})
end

@doc false
def parse_opts(mailer, opts) do
Logger.warn(
"#{__MODULE__}.parse_opts/2 has been deprecated. Use #{__MODULE__}.build_config/2"
)

otp_app = Keyword.fetch!(opts, :otp_app)
build_config(mailer, otp_app)
end

def build_config(mailer, otp_app, optional_overrides \\ %{}) do
otp_app
|> Application.fetch_env!(mailer)
Expand Down
9 changes: 0 additions & 9 deletions lib/bamboo/strategies/task_supervisor_strategy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,4 @@ defmodule Bamboo.TaskSupervisorStrategy do
def supervisor_name do
Bamboo.TaskSupervisor
end

@doc false
def child_spec do
raise """
Bamboo.TaskSupervisorStrategy is now automatically started by the :bamboo application.
Please remove the call to Bamboo.TaskSupervisorStrategy.child_spec
"""
end
end
6 changes: 0 additions & 6 deletions test/lib/bamboo/strategies/task_supervisor_strategy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,4 @@ defmodule Bamboo.TaskSupervisorStrategyTest do
assert %RuntimeError{message: "an error happened"} = elem(error, 0)
refute_receive :delivered
end

test "child_spec raises error about removal" do
assert_raise RuntimeError, ~r/Bamboo.TaskSupervisorStrategy.child_spec/, fn ->
Bamboo.TaskSupervisorStrategy.child_spec()
end
end
end

0 comments on commit e43a28a

Please sign in to comment.