Module: MetaProject::Tracker::Jira::JiraIssues

Included in:
JiraTracker
Defined in:
lib/meta_project/tracker/jira/jira_issues.rb

Overview

This module should be included by trackers that follow a digit-based issue scheme

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.command_patternObject

Patois command pattern



14
15
16
# File 'lib/meta_project/tracker/jira/jira_issues.rb', line 14

def command_pattern
  /([A-Za-z]*).?([A-Za-z]+-[\d]+(?:(?:[, &]*|\s?and\s?)[A-Za-z]+-[\d]+)*)/
end

.issue_patternObject

Patois issue pattern



8
9
10
# File 'lib/meta_project/tracker/jira/jira_issues.rb', line 8

def issue_pattern
  /([A-Za-z]+-[\d]+)/
end

Instance Method Details

#identifier_examplesObject



19
20
21
# File 'lib/meta_project/tracker/jira/jira_issues.rb', line 19

def identifier_examples
  ["DC-420", "pico-12"]
end

#markup(text) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/meta_project/tracker/jira/jira_issues.rb', line 23

def markup(text)
  text.gsub(issue_pattern) do |match|
    issue_identifier = $1.upcase
    issue = issue(issue_identifier)
    link_text = (issue.summary && issue.summary.strip! != "") ? "#{issue_identifier}: #{issue.summary}" : issue_identifier
    issue.url ? "<a href=\"#{issue.url}\">#{link_text}</a>" : issue_identifier
  end
end