Module: Gith::Start

Includes:
Git, Pivotal
Included in:
Commands
Defined in:
lib/gith/commands/start.rb

Constant Summary

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 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

#start(id) ⇒ Object



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

def start(id)
  id = id.gsub(/\D/, '')

  @story = story(id.to_i)

  if @story.estimate == -1
    notify "Cannot start unestimated story"
    @project = project_from_story(id)
    resp     = asks "To estimate now, enter an integer in #{@project.point_scale}, otherwise exiting: "
    exit unless estimate(id, resp)
  end

  error "Story already started" if @story.current_state == Gith::Pivotal::STARTED

  create_branch(@story) and start_story(@story) and take_ownership(@story)

  success "Story #{id} started"
end