Igniter.Libs.Phoenix (igniter v0.6.28)
View SourceCodemods & utilities for working with Phoenix
Summary
Functions
Adds a pipeline to a Phoenix router.
Adds a scope to a Phoenix router.
Appends code to a Phoenix router pipeline.
Appends to a phoenix router scope.
Returns true
if the module is a Phoenix controller
Gets the list of endpoints that use a given router
Returns {igniter, true}
if a pipeline exists in a Phoenix router, and {igniter, false}
otherwise.
Returns true
if the module is a Phoenix HTML module
Lists all routers found in the project.
Lists all web modules found in the project.
Moves to the use statement in a module that matches use <WebModule>, :router
Prepends code to a Phoenix router pipeline.
Selects an endpoint to be used in a later step. If only one endpoint is found, it will be selected automatically.
Selects a router to be used in a later step. If only one router is found, it will be selected automatically.
Returns the web module name for the current app
Checks if a module is a valid web module.
Returns the web module name for the current app
Generates a module name that lives in the Web directory of the current app.
Generates a module name that lives in the Web directory of the current app.
Functions
Adds a pipeline to a Phoenix router.
Options
:router
- The router module to append to. Will be looked up if not provided.:arg2
- The second argument to the scope macro. Must be a value (typically a module).
Adds a scope to a Phoenix router.
Options
:router
- The router module to append to. Will be looked up if not provided.:arg2
- The second argument to the scope macro. Must be a value (typically a module).:placement
-:before
|:after
. Determines where thecontents
will be placed::before
- place before the first scope in the module if one is found, otherwise tries to place after the last pipeline or after theuse MyAppWeb, :router
call.:after
- place at the end (bottom) of the module, after all scopes and pipelines.
Appends code to a Phoenix router pipeline.
Options
:router
- The router module to append to. Will be looked up if not provided.
Appends to a phoenix router scope.
Relatively limited currently only exact matches of a top level route, second argument, and pipelines.
Options
:router
- The router module to append to. Will be looked up if not provided.:arg2
- The second argument to the scope macro. Must be a value (typically a module).:with_pipelines
- A list of pipelines that the pipeline must be using to be considered a match.
:placement
-:before
|:after
. Determines where thecontents
will be placed. Note that it first tries to find a matching scope and place the contents into that scope, otherwise:placement
is used to determine where to place the contents::before
- place before the first scope in the module if one is found, otherwise tries to place after the last pipeline or after theuse MyAppWeb, :router
call.:after
- place at the end (bottom) of the module, after all scopes and pipelines.
Returns true
if the module is a Phoenix controller
Gets the list of endpoints that use a given router
Returns {igniter, true}
if a pipeline exists in a Phoenix router, and {igniter, false}
otherwise.
Options
:router
- The router module to append to. Will be looked up if not provided.:arg2
- The second argument to the scope macro. Must be a value (typically a module).
Returns true
if the module is a Phoenix HTML module
Lists all routers found in the project.
Lists all web modules found in the project.
A web module is defined as:
- Only one level of namespace deep (e.g.,
FooWeb
notFoo.BarWeb
) - Ends with
Web
@spec move_to_router_use(Igniter.t(), Sourceror.Zipper.t()) :: :error | {:ok, Sourceror.Zipper.t()}
Moves to the use statement in a module that matches use <WebModule>, :router
Prepends code to a Phoenix router pipeline.
Options
:router
- The router module to append to. Will be looked up if not provided.
Selects an endpoint to be used in a later step. If only one endpoint is found, it will be selected automatically.
If no endpoints exist, {igniter, nil}
is returned.
If multiple endpoints are found, the user is prompted to select one of them.
Selects a router to be used in a later step. If only one router is found, it will be selected automatically.
If no routers exist, {igniter, nil}
is returned.
If multiple routes are found, the user is prompted to select one of them.
Returns the web module name for the current app
Checks if a module is a valid web module.
A web module is defined as:
- Only one level of namespace deep (e.g.,
FooWeb
notFoo.BarWeb
) - Ends with
Web
Accepts both atoms and strings.
@spec web_module_name() :: module()
Returns the web module name for the current app
Generates a module name that lives in the Web directory of the current app.
Generates a module name that lives in the Web directory of the current app.