25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/terjira/client/auth_option_builder.rb', line 25
def build_auth_options_by_tty(options = {})
puts 'Login will be required...'
prompt = TTY::Prompt.new
result = prompt.collect do
key(:site).ask('Site (ex: https://myjira.atlassian.net):', required: true)
key(:context_path).ask('Jira path in your site (just press enter if you don\'t have):', default: '')
key(:username).ask('Username:', required: true)
key(:password).mask('Password:', required: true)
if options['ssl-config']
key(:use_ssl).yes?('Use SSL?')
key(:ssl_verify_mode).select('Verify mode:') do ||
.choice 'Verify peer', OpenSSL::SSL::VERIFY_PEER
.choice 'Verify client once', OpenSSL::SSL::VERIFY_CLIENT_ONCE
.choice 'Verify fail if no peer cert', OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
.choice 'Verify none', OpenSSL::SSL::VERIFY_NONE
end
end
if options['proxy-config']
key(:proxy_address).ask("Proxy address: ", default: nil)
key(:proxy_port).ask("Proxy port: ", default: nil)
end
end
result[:auth_type] = :basic
result[:use_ssl] ||= false if result[:site] =~ /http\:\/\//
result
end
|