Class: Reviewer::Setup::Formatter
- Inherits:
-
Object
- Object
- Reviewer::Setup::Formatter
- Includes:
- Output::Formatting
- Defined in:
- lib/reviewer/setup/formatter.rb
Overview
Display logic for the first-run setup flow
Constant Summary
Constants included from Output::Formatting
Output::Formatting::CHECKMARK, Output::Formatting::XMARK
Instance Method Summary collapse
-
#first_run_greeting ⇒ void
Displays the welcome message when Reviewer has no configuration file.
-
#first_run_skip ⇒ void
Displays a hint about ‘rvw init` when the user declines initial setup.
-
#initialize(output) ⇒ Formatter
constructor
Creates a formatter for setup flow display.
-
#setup_already_exists(config_file) ⇒ void
Displays a notice when ‘rvw init` is run but .reviewer.yml already exists.
-
#setup_no_tools_detected ⇒ void
Displays a message when auto-detection finds no supported tools in the project.
-
#setup_success(results) ⇒ void
Displays the results of a successful setup with the detected tools.
Constructor Details
#initialize(output) ⇒ Formatter
Creates a formatter for setup flow display
18 19 20 21 |
# File 'lib/reviewer/setup/formatter.rb', line 18 def initialize(output) @output = output @printer = output.printer end |
Instance Method Details
#first_run_greeting ⇒ void
This method returns an undefined value.
Displays the welcome message when Reviewer has no configuration file
26 27 28 29 30 31 32 |
# File 'lib/reviewer/setup/formatter.rb', line 26 def first_run_greeting output.newline printer.puts(:bold, "It looks like you're setting up Reviewer for the first time on this project.") output.newline printer.puts(:muted, 'This will auto-detect your tools and generate a .reviewer.yml configuration file.') output.newline end |
#first_run_skip ⇒ void
This method returns an undefined value.
Displays a hint about ‘rvw init` when the user declines initial setup
37 38 39 40 |
# File 'lib/reviewer/setup/formatter.rb', line 37 def first_run_skip printer.puts(:muted, 'You can run `rvw init` any time to auto-detect and configure your tools.') output.newline end |
#setup_already_exists(config_file) ⇒ void
This method returns an undefined value.
Displays a notice when ‘rvw init` is run but .reviewer.yml already exists
46 47 48 49 50 51 52 53 |
# File 'lib/reviewer/setup/formatter.rb', line 46 def setup_already_exists(config_file) output.newline printer.puts(:bold, "Configuration already exists: #{config_file.basename}") output.newline printer.puts(:muted, 'Run `rvw doctor` for a diagnostic report.') printer.puts(:muted, 'To regenerate, remove the file and run `rvw init` again.') output.newline end |
#setup_no_tools_detected ⇒ void
This method returns an undefined value.
Displays a message when auto-detection finds no supported tools in the project
58 59 60 61 62 63 64 65 |
# File 'lib/reviewer/setup/formatter.rb', line 58 def setup_no_tools_detected output.newline printer.puts(:bold, 'No supported tools detected.') output.newline printer.puts(:muted, 'Create .reviewer.yml manually:') printer.puts(:muted, " #{Setup::CONFIG_URL}") output.newline end |
#setup_success(results) ⇒ void
This method returns an undefined value.
Displays the results of a successful setup with the detected tools
71 72 73 74 75 76 |
# File 'lib/reviewer/setup/formatter.rb', line 71 def setup_success(results) output.newline printer.puts(:success, 'Created .reviewer.yml') print_detected_tools(results) end |