PhoenixKit.Install.RuntimeDetector (phoenix_kit v1.6.16)
View SourceDetects Phoenix runtime configuration patterns and determines appropriate config strategy.
This module analyzes Phoenix project configuration files to determine:
- Whether the project uses runtime.exs patterns
- The appropriate configuration file to modify
- The correct insertion location for PhoenixKit configuration
Summary
Functions
Detects if the project uses runtime configuration patterns.
Checks if dev.exs file exists.
Finds the appropriate insertion point for PhoenixKit configuration.
Finds the appropriate location within runtime.exs for development configuration.
Checks if runtime.exs contains runtime configuration patterns.
Checks if runtime.exs file exists in the project.
Checks if dev.exs file exists and is simple enough to modify.
Functions
Detects if the project uses runtime configuration patterns.
Returns
:runtime- Uses runtime.exs with conditional blocks:dev_exs- Uses simple dev.exs file:config_exs- Uses config.exs with environment variables
Examples
iex> RuntimeDetector.detect_config_pattern()
:runtime
Checks if dev.exs file exists.
Returns
true if dev.exs exists, false otherwise.
Finds the appropriate insertion point for PhoenixKit configuration.
Returns
{:runtime, line_number}- Insert at specific line in runtime.exs{:dev_exs, line_number}- Insert at end of dev.exs{:config_exs, line_number}- Insert in config.exs with env check
Examples
iex> RuntimeDetector.find_insertion_point()
{:runtime, 76}
Finds the appropriate location within runtime.exs for development configuration.
Returns
line_number where PhoenixKit config should be inserted.
Checks if runtime.exs contains runtime configuration patterns.
Returns
true if runtime patterns are detected, false otherwise.
Checks if runtime.exs file exists in the project.
Returns
true if runtime.exs exists, false otherwise.
Checks if dev.exs file exists and is simple enough to modify.
Returns
true if simple dev.exs exists, false otherwise.