Class: Pvectl::Config::Wizard
- Inherits:
-
Object
- Object
- Pvectl::Config::Wizard
- Defined in:
- lib/pvectl/config/wizard.rb
Overview
Interactive configuration wizard for first-time setup.
Wizard guides users through initial configuration by prompting for server URL, authentication credentials, and SSL settings. It only runs when stdin is a TTY (not in pipes or scripts).
Class Method Summary collapse
-
.available? ⇒ Boolean
Checks if the wizard can run (stdin is a TTY).
Instance Method Summary collapse
-
#initialize(prompt: nil) ⇒ Wizard
constructor
Creates a new Wizard instance.
-
#run ⇒ Hash
Runs the interactive wizard and returns configuration.
Constructor Details
#initialize(prompt: nil) ⇒ Wizard
Creates a new Wizard instance.
32 33 34 |
# File 'lib/pvectl/config/wizard.rb', line 32 def initialize(prompt: nil) @prompt = prompt || create_default_prompt end |
Class Method Details
.available? ⇒ Boolean
Checks if the wizard can run (stdin is a TTY).
25 26 27 |
# File 'lib/pvectl/config/wizard.rb', line 25 def self.available? $stdin.tty? end |
Instance Method Details
#run ⇒ Hash
Runs the interactive wizard and returns configuration.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pvectl/config/wizard.rb', line 39 def run server = prompt_server verify_ssl = prompt_ssl auth_type = prompt_auth_type credentials = prompt_credentials(auth_type) context_name = prompt_context_name build_config( server: server, verify_ssl: verify_ssl, auth_type: auth_type, credentials: credentials, context_name: context_name ) end |