Module: MetaProject::Tracker::DigitIssues
- Included in:
- Trac::TracTracker, XForge::XForgeTracker
- Defined in:
- lib/meta_project/tracker/digit_issues.rb
Overview
This module should be included by trackers that follow a digit-based issue scheme. TODO: Make issue_pattern and command_pattern attributes so they can be modified. Provide examples.
Class Method Summary collapse
-
.command_pattern ⇒ Object
Patois command pattern.
-
.issue_pattern ⇒ Object
Patois issue pattern.
Instance Method Summary collapse
- #identifier_examples ⇒ Object
-
#markup(text) ⇒ Object
TODO: find a way to extract just the issue summaries so they can be stored in dc as an array embedded in the revision object.
Class Method Details
.command_pattern ⇒ Object
Patois command pattern
13 14 15 |
# File 'lib/meta_project/tracker/digit_issues.rb', line 13 def command_pattern @command_pattern ||= /([A-Za-z]*).?(\#[\d]+(?:(?:[, &]*|\s?and\s?)\#[\d]+)*)/ end |
.issue_pattern ⇒ Object
Patois issue pattern
7 8 9 |
# File 'lib/meta_project/tracker/digit_issues.rb', line 7 def issue_pattern @issue_pattern ||= /\#([\d]+)/ end |
Instance Method Details
#identifier_examples ⇒ Object
18 19 20 |
# File 'lib/meta_project/tracker/digit_issues.rb', line 18 def identifier_examples ["#1926", "#1446"] end |
#markup(text) ⇒ Object
TODO: find a way to extract just the issue summaries so they can be stored in dc as an array embedded in the revision object. that way we don’t alter the original commit message
24 25 26 27 28 29 30 31 |
# File 'lib/meta_project/tracker/digit_issues.rb', line 24 def markup(text) text.gsub(issue_pattern) do |match| issue_identifier = $1 issue = issue(issue_identifier) link_text = (issue && issue.summary && issue.summary.strip! != "") ? "#{issue_identifier}: #{issue.summary}" : issue_identifier (issue && issue.url) ? "<a href=\"#{issue.url}\">\##{link_text}</a>" : "\##{issue_identifier}" end end |