Class: RHC::Wizard

Inherits:
Object show all
Includes:
HighLine::SystemExtensions, CartridgeHelpers, GitHelpers, Helpers, SSHHelpers
Defined in:
lib/rhc/wizard.rb

Direct Known Subclasses

DomainWizard, EmbeddedWizard, RerunWizard, SSHWizard

Constant Summary collapse

DEFAULT_MAX_LENGTH =
16
CONFIG_STAGES =
[
  :login_stage,
  :create_config_stage,
]
KEY_STAGES =
[
  :config_ssh_key_stage,
  :upload_ssh_key_stage,
]
TEST_STAGES =
[
  :install_client_tools_stage,
  :setup_test_stage,
]
NAMESPACE_STAGES =
[
  :config_namespace_stage,
]
APP_STAGES =
[
  :show_app_info_stage,
]
STAGES =
[:greeting_stage] + CONFIG_STAGES + KEY_STAGES + TEST_STAGES + NAMESPACE_STAGES + APP_STAGES + [:finalize_stage]

Constants included from Helpers

Helpers::BOUND_WARNING, Helpers::PREFIX, Helpers::ROLES

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GitHelpers

#git_clone_application, #git_clone_deploy_hooks, #git_clone_repo, #git_config_get, #git_config_set, #git_version, #has_git?

Methods included from SSHHelpers

#check_ssh_executable!, #exe?, #fingerprint_for_default_key, #fingerprint_for_local_key, #generate_ssh_key_ruby, #has_ssh?, #run_on_gears, #ssh_command_for_op, #ssh_key_triple_for, #ssh_key_triple_for_default_key, #ssh_keygen_fallback, #ssh_ruby, #ssh_send_file_ruby, #ssh_send_url_ruby, #ssh_version, #table_from_gears

Methods included from Helpers

#agree, #certificate_file, #client_from_options, #collect_env_vars, #color, #confirm_action, #date, #datetime_rfc3339, #debug, #debug?, #debug_error, #decode_json, #deprecated, #deprecated_command, #disable_deprecated?, #distance_of_time_in_words, #env_var_regex_pattern, #error, #exec, #host_exists?, #hosts_file_contains?, #human_size, #info, #interactive?, #jruby?, #mac?, #pluralize, #protonbox_online_server?, #protonbox_rest_endpoint, #protonbox_url, #results, #role_name, #run_with_tee, #ssh_string, #ssh_string_parts, #ssl_options, #success, #system_path, #table_heading, #to_host, #to_uri, #token_for_user, #unix?, #user_agent, #warn, #windows?, #with_tolerant_encoding

Methods included from OutputHelpers

#default_display_env_var, #display_app, #display_app_configurations, #display_authorization, #display_cart, #display_cart_storage_info, #display_cart_storage_list, #display_deployment, #display_deployment_list, #display_domain, #display_env_var_list, #display_key, #format_cart_gears, #format_cart_header, #format_gear_info, #format_key_header, #format_scaling_info, #format_usage_message

Constructor Details

#initialize(config = RHC::Config.new, opts = Commander::Command::Options.new) ⇒ Wizard

Running the setup wizard may change the contents of opts and config if the create_config_stage completes successfully.



45
46
47
48
# File 'lib/rhc/wizard.rb', line 45

def initialize(config=RHC::Config.new, opts=Commander::Command::Options.new)
  @config = config
  @options = opts
end

Instance Attribute Details

#rest_clientObject

Returns the value of attribute rest_client.



39
40
41
# File 'lib/rhc/wizard.rb', line 39

def rest_client
  @rest_client
end

Class Method Details

.has_configuration?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/rhc/wizard.rb', line 9

def self.has_configuration?
  File.exists? RHC::Config.local_config_path
end

Instance Method Details

#runObject

Public: Runs the setup wizard to make sure ~/.protonbox and ~/.ssh are correct

Examples

wizard.run()
# => true

Returns nil on failure or true on success



58
59
60
61
62
63
64
65
66
# File 'lib/rhc/wizard.rb', line 58

def run
  stages.each do |stage|
    debug "Running #{stage}"
    if self.send(stage).nil?
      return nil
    end
  end
  true
end

#stagesObject



35
36
37
# File 'lib/rhc/wizard.rb', line 35

def stages
  STAGES
end