Class: Nvoi::Cli::Onboard::Command

Inherits:
Object
  • Object
show all
Includes:
Ui
Defined in:
lib/nvoi/cli/onboard/command.rb

Overview

Interactive onboarding wizard for quick setup

Constant Summary collapse

SUMMARY_ACTIONS =
[
  { name: "Save configuration", value: :save },
  { name: "Edit application name", value: :app_name },
  { name: "Edit compute provider", value: :compute },
  { name: "Edit domain provider", value: :domain },
  { name: "Edit apps", value: :apps },
  { name: "Edit database", value: :database },
  { name: "Edit environment variables", value: :env },
  { name: "Start over", value: :restart },
  { name: "Cancel (discard)", value: :cancel }
].freeze

Constants included from Ui

Ui::MAX_RETRIES

Instance Method Summary collapse

Methods included from Ui

#box, #error, #output, #prompt_with_retry, #section, #success, #table, #with_spinner

Constructor Details

#initialize(prompt: nil) ⇒ Command

Returns a new instance of Command.



26
27
28
29
30
31
# File 'lib/nvoi/cli/onboard/command.rb', line 26

def initialize(prompt: nil)
  @prompt = prompt || TTY::Prompt.new
  @test_mode = prompt&.input.is_a?(StringIO)
  @data = default_data
  @domain_step = nil
end

Instance Method Details

#runObject



33
34
35
36
37
38
39
40
41
# File 'lib/nvoi/cli/onboard/command.rb', line 33

def run
  show_welcome
  collect_all
  summary_loop
  show_next_steps
rescue TTY::Reader::InputInterrupt
  output.puts "\n\nSetup cancelled."
  exit 1
end