Module: Gith::Deliver

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

#finish, #request_review_for

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

Methods included from Slack

#deploy_env, #lock_and_deploy, #lock_env, #post_message, #slack

Instance Method Details

#deliverObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gith/commands/deliver.rb', line 12

def deliver
  notify "Delivering 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 delivered.' if @story.current_state == 'delivered'

  if @story.current_state == 'started'
    yes_or_no('Story not finished. Exiting unless you want to finish it. Finish now?') ? finish : exit
  end

  deliver_story @story

  @pull_request = pull_for current_branch

  notify "Labeling as '#{DELIVERED.cyan}'"

  remove_label        @pull_request, FINISHED
  label_pull_request  @pull_request, DELIVERED

  notify "Compressing hubot commit comments"
  compress_comments(@story)

  error('All staging environments are occupado.') unless @env = Hubot.open_env

  lock_and_deploy @env, @story.name, current_branch
end