Move Mailers To apps/
Hanami architecture has one golden rule: the core of a Hanami project lives in lib/
, while the deliverability mechanisms (for the web) live in apps/
. The code in apps/
can reference (depend) code in lib/
but NOT viceversa.
Because we offer Interactors (aka service objects) as part of the core of a Hanami project, their natural place is lib/
.
Interactors sometimes need to send emails, so to not break the golden rule above, we put mailers in lib/
too.
This is wrong for two reasons:
- Mailers are deliverability mechanisms too, so they shouldn’t stay in
lib/
- If they stay out of
apps/
they cannot access to assets helpers
The solution is to move mailers to apps/
, and so the command to generate a mailer should go from:
hanami generate mailer welcome
to:
hanami generate mailer web welcome
Where web
is one of the applications living under apps/
. This is the same concept of hanami generate action
command.
Because this is a breaking change the target release is 2.0
.