Class: FlashFlow::IssueTracker::Pivotal
- Inherits:
-
Object
- Object
- FlashFlow::IssueTracker::Pivotal
- Defined in:
- lib/flash_flow/issue_tracker/pivotal.rb
Instance Method Summary collapse
-
#initialize(branches, git, opts = {}) ⇒ Pivotal
constructor
A new instance of Pivotal.
- #production_deploy ⇒ Object
- #release_keys(story_id) ⇒ Object
- #release_notes(hours, file = STDOUT) ⇒ Object
- #stories_delivered ⇒ Object
- #stories_for_release(release_key) ⇒ Object
- #stories_pushed ⇒ Object
- #story_deployable?(story_id) ⇒ Boolean
- #story_link(story_id) ⇒ Object
- #story_title(story_id) ⇒ Object
Constructor Details
#initialize(branches, git, opts = {}) ⇒ Pivotal
Returns a new instance of Pivotal.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 8 def initialize(branches, git, opts={}) @branches = branches @git = git @timezone = opts['timezone'] || "UTC" @project_id = opts['project_id'] PivotalTracker::Client.token = opts['token'] PivotalTracker::Client.use_ssl = true @release_label_prefix = Regexp.new("^#{opts['release_label_prefix'] || 'release'}", Regexp::IGNORECASE) end |
Instance Method Details
#production_deploy ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 41 def production_deploy shipped_branches.each do |branch| branch.stories.to_a.each do |story_id| comment(story_id) end end end |
#release_keys(story_id) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 77 def release_keys(story_id) story = get_story(story_id) return [] unless story && story.labels story.labels.split(",").map(&:strip).select { |label| label =~ @release_label_prefix }.map(&:strip) end |
#release_notes(hours, file = STDOUT) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 49 def release_notes(hours, file=STDOUT) release_stories = done_and_current_stories.map do |story| shipped_text = has_shipped_text?(story) format_release_data(story.id, story.name, shipped_text) if shipped_text end.compact release_notes = release_by(release_stories, hours) print_release_notes(release_notes, file) end |
#stories_delivered ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 27 def stories_delivered merged_branches.each do |branch| branch.stories.to_a.each do |story_id| deliver(story_id) end end removed_and_failed_branches.each do |branch| branch.stories.to_a.each do |story_id| undeliver(story_id) end end end |
#stories_for_release(release_key) ⇒ Object
85 86 87 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 85 def stories_for_release(release_key) stories_for_label(release_key) end |
#stories_pushed ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 19 def stories_pushed if merged_working_branch merged_working_branch.stories.to_a.each do |story_id| finish(story_id) end end end |
#story_deployable?(story_id) ⇒ Boolean
59 60 61 62 63 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 59 def story_deployable?(story_id) story = get_story(story_id) story && story.current_state == 'accepted' end |
#story_link(story_id) ⇒ Object
65 66 67 68 69 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 65 def story_link(story_id) story = get_story(story_id) story.url if story end |
#story_title(story_id) ⇒ Object
71 72 73 74 75 |
# File 'lib/flash_flow/issue_tracker/pivotal.rb', line 71 def story_title(story_id) story = get_story(story_id) story.name if story end |