class RHC::Wizard

Constants

DEFAULT_MAX_LENGTH
STAGES

Attributes

auth[RW]
config[R]
options[R]
rest_client[RW]
user[RW]

Public Class Methods

has_configuration?() click to toggle source
# File lib/rhc/wizard.rb, line 10
def self.has_configuration?
  File.exists? RHC::Config.local_config_path
end
new(config=RHC::Config.new, opts=Commander::Command::Options.new) click to toggle source

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

# File lib/rhc/wizard.rb, line 36
def initialize(config=RHC::Config.new, opts=Commander::Command::Options.new)
  @config = config
  @options = opts
  @debug = opts.debug if opts
end

Public Instance Methods

run() click to toggle source

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

Examples

wizard.run()
# => true

Returns nil on failure or true on success

# File lib/rhc/wizard.rb, line 50
def run
  stages.each do |stage|
    debug "Running #{stage}"
    if self.send(stage).nil?
      return nil
    end
  end
  true
end
stages() click to toggle source
# File lib/rhc/wizard.rb, line 26
def stages
  STAGES
end

Protected Instance Methods

core_auth() click to toggle source
# File lib/rhc/wizard.rb, line 78
def core_auth
  @core_auth ||= RHC::Auth::Basic.new(options)
end
new_client_for_options() click to toggle source
# File lib/rhc/wizard.rb, line 72
def new_client_for_options
  client_from_options({
    :auth => auth,
  })
end
openshift_server() click to toggle source
# File lib/rhc/wizard.rb, line 68
def openshift_server
  options.server || config['libra_server'] || "openshift.redhat.com"
end
print_dot() click to toggle source
token_auth() click to toggle source
# File lib/rhc/wizard.rb, line 82
def token_auth
  RHC::Auth::Token.new(options, core_auth, token_store)
end
token_store() click to toggle source
# File lib/rhc/wizard.rb, line 97
def token_store
  @token_store ||= RHC::Auth::TokenStore.new(config.home_conf_path)
end
username() click to toggle source
# File lib/rhc/wizard.rb, line 101
def username
  auth.username if auth.respond_to?(:username)
end