Class: Yao::Yrb::Cli

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/yao/yrb/cli.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/yao/yrb/cli.rb', line 22

def execute
  yao_setup

  if script_mode.size.positive?
    script_file = script_mode.first
    load script_file
  else
    IRB.setup(__FILE__)
    conf = IRB.conf
    conf[:AP_NAME] = 'yrb'
    conf[:IRB_NAME] = 'yrb'
    irb = IRB::Irb.new
    irb.run(conf)
  end
end

#yao_setupObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/yao/yrb/cli.rb', line 38

def yao_setup
  Yao.configure do
    auth_url              ENV.fetch('OS_AUTH_URL', nil)
    tenant_name           ENV.fetch('OS_TENANT_NAME', nil)
    username              ENV.fetch('OS_USERNAME', nil)
    password              ENV.fetch('OS_PASSWORD', nil)
    ca_cert               ENV.fetch('OS_CACERT', nil)
    client_cert           ENV.fetch('OS_CERT', nil)
    client_key            ENV.fetch('OS_KEY', nil)
    region_name           ENV.fetch('OS_REGION_NAME', nil)
    identity_api_version  ENV.fetch('OS_IDENTITY_API_VERSION', nil)
    user_domain_name      ENV.fetch('OS_USER_DOMAIN_NAME', nil)
    project_domain_name   ENV.fetch('OS_PROJECT_DOMAIN_NAME', nil)
    debug                 ENV.fetch('YAO_DEBUG', nil)
    debug_record_response ENV.fetch('YAO_DEBUG_RECORD_RESPONSE', nil)
  end
end