class Jira::Command::Install
Public Instance Methods
run()
click to toggle source
# File lib/jira/commands/install.rb, line 30 def run io.say('Please enter your JIRA information.') inifile[:global] = base_params inifile.write # Do this now because cookie authentication uses api calls inifile.delete_section("cookie") if inifile.has_section?("cookie") case authentication when "basic" inifile[:global][:password] = password when "token" inifile[:global][:token] = token when "cookie" response = cookie(session_params) inifile[:cookie] = {} inifile[:cookie][:name] = response['name'] inifile[:cookie][:value] = response['value'] end inifile.write end
Private Instance Methods
authentication()
click to toggle source
# File lib/jira/commands/install.rb, line 82 def authentication @authentication ||= io.select( "Select an authentication type:", ["basic", "cookie", "token"] ) end
base_params()
click to toggle source
# File lib/jira/commands/install.rb, line 61 def base_params { url: url, username: username } end
inifile()
click to toggle source
# File lib/jira/commands/install.rb, line 111 def inifile @inifile ||= IniFile.new( comment: '#', encoding: 'UTF-8', filename: Jira::Core.cli_path ) end
password()
click to toggle source
# File lib/jira/commands/install.rb, line 97 def password io.mask("JIRA password:") end
session_params()
click to toggle source
# File lib/jira/commands/install.rb, line 75 def session_params { username: username, password: password } end
token()
click to toggle source
# File lib/jira/commands/install.rb, line 101 def token io.ask("JIRA token:") end
url()
click to toggle source
# File lib/jira/commands/install.rb, line 89 def url @url ||= io.ask("JIRA URL:") end
username()
click to toggle source
# File lib/jira/commands/install.rb, line 93 def username @username ||= io.ask("JIRA username:") end