Class: CiToolkit::Jira

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_toolkit/jira.rb

Overview

Utility class to parse a Jira ticket from a string

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github_pr = CiToolkit::DvcsPrFactory.create(CiToolkit::BitriseEnv.new), git = CiToolkit::Git.new, ticket_regex_keys = ENV.fetch("SUPPORTED_JIRA_PROJECT_KEYS_REGEX", nil)) ⇒ Jira

Returns a new instance of Jira.



8
9
10
11
12
13
14
15
# File 'lib/ci_toolkit/jira.rb', line 8

def initialize(
  github_pr = CiToolkit::DvcsPrFactory.create(CiToolkit::BitriseEnv.new),
  git = CiToolkit::Git.new,
  ticket_regex_keys = ENV.fetch("SUPPORTED_JIRA_PROJECT_KEYS_REGEX", nil)
)
  @ticket_regex_keys = ticket_regex_keys
  @ticket = parse_ticket(github_pr.nil? ? "" : github_pr.title) || parse_ticket(git.nil? ? "" : git.branch)
end

Instance Attribute Details

#ticketObject (readonly)

Returns the value of attribute ticket.



6
7
8
# File 'lib/ci_toolkit/jira.rb', line 6

def ticket
  @ticket
end