Module: Gith::Finish
- Defined in:
- lib/gith/commands/finish.rb
Constant Summary
Constants included from Github
Github::DNM, Github::PASSED_REVIEW, Github::PENDING_REVIEW, Github::REVIEW_ME, Github::WIP
Constants included from Pivotal
Pivotal::ACCEPTED, Pivotal::DELIVERED, Pivotal::FINISHED, Pivotal::REJECTED, Pivotal::STARTED, Pivotal::V5_URL
Instance Method Summary collapse
Methods included from Git
#branch_name, #commit_all, #create_branch, #current_branch, #current_story_id, #push_branch, #push_current_branch, #unstaged_changes?
Methods included from Github
#add_comment, #github, #label_pull_request, #labels_for, #open_pull_request, #pull_for, #pull_request, #pull_requests, #remove_label, #remove_labels
Methods included from Pivotal
#accept_story, #compress_comments, #delete_comment, #deliver_story, #finish_story, #hubot_commit_comments, #me, #project, #project_from_story, #projects, #start_story, #story, #take_ownership
Instance Method Details
#finish ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gith/commands/finish.rb', line 10 def finish notify "Finishing story ##{current_story_id.to_s.magenta}" commit_all if unstaged_changes? && yes_or_no("Unstaged changes, would you like to commit now?") @story = story(current_story_id) notify "Story already finished" if @story.current_state == 'finished' notify "Pushing branch #{current_branch.cyan} to origin" push_current_branch if @pull_request = pull_for(current_branch) notify "Pull request already exists for #{current_branch.cyan}" else notify "Opening pull request" @pull_request = open_pull_request current_branch, @story.name, "[finishes ##{current_story_id}]" end notify "Labeling as '#{FINISHED.cyan}' & '#{PENDING_REVIEW.cyan}'" label_pull_request @pull_request, FINISHED, PENDING_REVIEW request_review_for(@story) finish_story @story success "Story #{@story.id} finished" end |
#request_review_for(id) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/gith/commands/finish.rb', line 36 def request_review_for(id) project = project_from_story(id) reviewer = "reviewers" who = asks("Who should review your pull request? Default is #{'reviewers'.cyan}") reviewer = who.strip.empty? ? reviewer : who.strip team = "@hired/#{reviewer}" notify "Asking for review from #{team}" add_comment @pull_request, REVIEW_ME + team end |