5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/ki_youtrack/initializer.rb', line 5
def self.init
config = Kiseru::Config[:ki_youtrack]
ui = HighLine.new
old_subdomain = config.read('subdomain')
old_ssl = config.read('ssl')
old_login = config.read('login')
old_password = config.read('password')
subdomain = ui.ask("Subdomain: ") { |q| q.default = old_subdomain }
ssl = ui.ask("Do you have a public or private YouTrack account?: ", ->(reply) { reply.downcase != 'public'} ) do |q|
q.default = (old_ssl == false) ? "public" : "private"
q
end
login = ui.ask("Login (or email): ") { |q| q.default = old_login }
$stdout.puts "WARNING: Your YouTrack password will be written in plaintext to #{config.path}"
password = ui.ask("Password: ") { |q| q.echo = "*" }
config.write('login', login)
config.write('password', password)
config.write('subdomain', subdomain)
config.write('ssl', ssl)
$stdout.puts "Initialized config file at #{config.path}"
end
|