Class: VMC::Cli::Command::Base
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/cli/commands/base.rb', line 13
def initialize(options={})
@options = options.dup
@no_prompt = @options[:noprompts]
@prompt_ok = !no_prompt
if RUBY_PLATFORM =~ /darwin/ && RUBY_VERSION == '1.8.7' && RUBY_PATCHLEVEL <= 174
HighLine.track_eof = false
end
if !!RUBY_PLATFORM['mingw'] || !!RUBY_PLATFORM['mswin32'] || !!RUBY_PLATFORM['cygwin']
VMC::Cli::Config.colorize = false
end
end
|
Instance Attribute Details
#no_prompt ⇒ Object
Returns the value of attribute no_prompt.
11
12
13
|
# File 'lib/cli/commands/base.rb', line 11
def no_prompt
@no_prompt
end
|
#prompt_ok ⇒ Object
Returns the value of attribute prompt_ok.
11
12
13
|
# File 'lib/cli/commands/base.rb', line 11
def prompt_ok
@prompt_ok
end
|
Instance Method Details
#auth_token ⇒ Object
48
49
50
51
|
# File 'lib/cli/commands/base.rb', line 48
def auth_token
return @auth_token if @auth_token
@auth_token = VMC::Cli::Config.auth_token
end
|
30
31
32
33
34
35
36
|
# File 'lib/cli/commands/base.rb', line 30
def client
return @client if @client
@client = VMC::Client.new(target_url, auth_token)
@client.trace = true if VMC::Cli::Config.trace
@client.proxy_for @options[:proxy] if @options[:proxy]
@client
end
|
#client_info ⇒ Object
38
39
40
41
|
# File 'lib/cli/commands/base.rb', line 38
def client_info
return @client_info if @client_info
@client_info = client.info
end
|
#target_url ⇒ Object
43
44
45
46
|
# File 'lib/cli/commands/base.rb', line 43
def target_url
return @target_url if @target_url
@target_url = VMC::Cli::Config.target_url
end
|