Appends a route/2 clause to an existing MailglassInbound.Router module.
The edit is idempotent: running the task twice for the same mailbox is a
no-op. The route is appended as the last statement inside the router's
do-block.
Examples
mix mailglass.gen.inbound_route support@example.com MyApp.SupportMailbox
mix mailglass.gen.inbound_route support@example.com MyApp.SupportMailbox --router MyApp.InboundRouterPositional arguments
pattern- the envelope recipient to match (becomesrecipient: "<pattern>").mailbox- the mailbox module that handles the matched message.
Options
--router- the router module to edit. Defaults to<App>.InboundRouter.--recipient- override the recipient matcher (defaults topattern).--subject- add asubject:matcher to the generated route.
--dry-run is supported as the framework-provided global switch (it is not
in this task's option schema); it previews the diff and writes nothing.
Summary
Functions
Idempotently appends a route/2 for mailbox to router's do-block.
Returns true when the router's do-block already declares a route/2 whose
first argument is mailbox.
Resolves the router module to edit, honoring an explicit --router value and
otherwise defaulting to <App>.InboundRouter.
Functions
Idempotently appends a route/2 for mailbox to router's do-block.
Reused by mix mailglass.gen.mailbox so the route-stub insertion shares the
exact same dup-scan + add-route logic. When the router module is not found in
the project, an actionable notice is emitted (no module is auto-created).
opts accepts:
:recipient- the recipient matcher string (required for a useful route).:subject- an optional subject matcher string.
@spec route_already_present?(Sourceror.Zipper.t(), module()) :: boolean()
Returns true when the router's do-block already declares a route/2 whose
first argument is mailbox.
The zipper must be positioned at the router's do-block (as provided by
Igniter.Project.Module.find_and_update_module/3). Idempotency hinges on
argument_equals?/3 resolving the {:__aliases__, ...} mailbox AST against
the module atom.
Resolves the router module to edit, honoring an explicit --router value and
otherwise defaulting to <App>.InboundRouter.