class Jira::Core

Public Class Methods

cli_path() click to toggle source

@return [String] path to .jira-cli file

# File lib/jira/core.rb, line 64
def cli_path
  @cli_path ||= "#{Dir.home}/.jira-cli"
end
config() click to toggle source
# File lib/jira/core.rb, line 75
def config
  @config ||= (
    raise InstallationException unless File.exist?(cli_path)
    IniFile.load(cli_path, comment: '#', encoding: 'UTF-8')
  )
end
password() click to toggle source

@return [String] JIRA password

# File lib/jira/core.rb, line 22
def password
  @password ||= ENV['JIRA_PASSWORD'] || config[:global]['password']
end
ticket?(ticket, verbose=true) click to toggle source

Determines whether or not the input ticket matches the expected JIRA ticketing syntax. Outputs a warning that the input ticket isn't a valid ticket.

@param ticket [String] input ticket name @param verbose [Boolean] verbose output of the ticket warning

@return [Boolean] whether input string matches JIRA ticket syntax

# File lib/jira/core.rb, line 51
def ticket?(ticket, verbose=true)
  !!ticket.to_s[/^[a-zA-Z]+-[0-9]+$/] and return true
  if verbose
    puts "#{Jira::Format.ticket(ticket)} is not a valid JIRA ticket."
  end
  false
end
token() click to toggle source

@return [String] JIRA token

# File lib/jira/core.rb, line 29
def token
  @token ||= ENV['JIRA_TOKEN'] || config[:global]['token']
end
url() click to toggle source

@return [String] JIRA project endpoint

# File lib/jira/core.rb, line 8
def url
  @url ||= ENV['JIRA_URL'] || config[:global]['url']
end
username() click to toggle source

@return [String] JIRA username

# File lib/jira/core.rb, line 15
def username
  @username ||= ENV['JIRA_USERNAME'] || config[:global]['username']
end