module Story
Public Instance Methods
delivered_ids(text)
click to toggle source
Returns the ids of delivered stories found in the given text.
# File lib/pivotal-github/story.rb, line 9 def delivered_ids(text) delivered = text.scan(/\[Deliver(?:s|ed) (.*?)\]/).flatten # Handle multiple ids, i.e., '[Delivers #<id 1> #<id 2>]' delivered.inject([]) do |ids, element| ids.concat(element.scan(/[0-9]{8,}/).flatten) ids end.uniq end
delivered_ids_since_last_pr(text)
click to toggle source
Returns the ids delivered since the last pull request. We omit the ids of stories that have already been delivered by a particular pull request, so that each new PR is only tagged with stories delivered since the last PR.
# File lib/pivotal-github/story.rb, line 34 def delivered_ids_since_last_pr(text) delivered_ids(text) - pr_ids(text) end
fast_log_delivered_text()
click to toggle source
# File lib/pivotal-github/story.rb, line 26 def fast_log_delivered_text @delivered_text ||= `git log -E --grep '\\[Deliver(s|ed) #'` end
git_log_delivered_story_ids()
click to toggle source
Returns the ids of delivered stories according to the Git log. These ids are of the form [Delivers #<story id>] or [Delivers #<story id> #<another story id>]. The difference is handled by the delivered_ids
method.
# File lib/pivotal-github/story.rb, line 22 def git_log_delivered_story_ids delivered_ids(fast_log_delivered_text).uniq end
pr_ids(text)
click to toggle source
Returns the ids included in previous pull requests.
# File lib/pivotal-github/story.rb, line 39 def pr_ids(text) text.scan(/\[Deliver(?:s|ed) #(.*?)\]\(https:\/\//).flatten.uniq end
story_url(story_id)
click to toggle source
Returns the URL for the story at Pivotal
Tracker.
# File lib/pivotal-github/story.rb, line 4 def story_url(story_id) "https://www.pivotaltracker.com/story/show/#{story_id}" end