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 71 def cli_path @cli_path ||= root_path + "/.jira-cli" end
config()
click to toggle source
# File lib/jira/core.rb, line 82 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()
click to toggle source
@return [String] default ticket is the current branch
# File lib/jira/core.rb, line 44 def ticket `git rev-parse --abbrev-ref HEAD 2>/dev/null`.strip 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 58 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
Private Class Methods
root_path()
click to toggle source
# File lib/jira/core.rb, line 91 def root_path @root_path ||= ( root_path = `git rev-parse --show-toplevel 2>/dev/null`.strip raise GitException if root_path.empty? root_path ) end