Class: ActiverecordCallbackLens::CLI::App
- Inherits:
-
Thor
- Object
- Thor
- ActiverecordCallbackLens::CLI::App
- Defined in:
- lib/activerecord_callback_lens/cli/cli.rb
Overview
Thor application exposing the callback_lens command-line interface.
For v0.1 it provides a single command, analyze, which runs the full pipeline (collect -> parse -> build graph -> render) and prints a Mermaid diagram to stdout. An unknown model name is reported with a friendly message and a non-zero exit status rather than a Ruby backtrace.
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
Tells Thor to exit with a non-zero status when a command raises, so the exit 1 paths below propagate a failure code to the shell.
Instance Method Summary collapse
-
#analyze(model_name) ⇒ void
Runs the analysis pipeline for
model_nameand prints the result.
Class Method Details
.exit_on_failure? ⇒ Boolean
Tells Thor to exit with a non-zero status when a command raises, so the exit 1 paths below propagate a failure code to the shell.
24 25 26 |
# File 'lib/activerecord_callback_lens/cli/cli.rb', line 24 def self.exit_on_failure? true end |
Instance Method Details
#analyze(model_name) ⇒ void
This method returns an undefined value.
Runs the analysis pipeline for model_name and prints the result.
36 37 38 39 40 |
# File 'lib/activerecord_callback_lens/cli/cli.rb', line 36 def analyze(model_name) model_class = resolve_model(model_name) graph = build_graph(model_class, expand: [:expand]) puts Renderer::MermaidRenderer.render(graph) if [:mermaid] end |