Module: Gith::Discuss

Includes:
Git, Github, Pivotal
Included in:
Commands
Defined in:
lib/gith/commands/discuss.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

#discussObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gith/commands/discuss.rb', line 10

def discuss
  notify "Opening story ##{current_story_id.to_s.magenta} for discussion"
  commit_all if unstaged_changes? && yes_or_no("Unstaged changes, would you like to commit now?")

  @story = story(current_story_id)
  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, "[discusses ##{current_story_id}]"
  end

  notify "Labeling as '#{WIP.cyan}' & '#{DNM.cyan}'"
  label_pull_request @pull_request, WIP, DNM

  success "Story #{@story.id} open for discussion"
end