Class: GitPivotalTrackerIntegration::Command::Start

Inherits:
Base
  • Object
show all
Defined in:
lib/git-pivotal-tracker-integration/command/start.rb

Overview

The class that encapsulates starting a Pivotal Tracker Story

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GitPivotalTrackerIntegration::Command::Base

Instance Method Details

#run(filter) ⇒ void

This method returns an undefined value.

Starts a Pivotal Tracker story by doing the following steps:

  • Create a branch

  • Add default commit hook

  • Start the story on Pivotal Tracker

Parameters:

  • filter (String, nil)

    a filter for selecting the story to start. This filter can be either:

    • a story id

    • a story type (feature, bug, chore)

    • nil



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/git-pivotal-tracker-integration/command/start.rb', line 36

def run(filter)
  story = GitPivotalTrackerIntegration::Util::Story.select_story @project, filter

  GitPivotalTrackerIntegration::Util::Story.pretty_print story

  development_branch_name = development_branch_name story
  GitPivotalTrackerIntegration::Util::Git.create_branch development_branch_name
  @configuration.story = story

  GitPivotalTrackerIntegration::Util::Git.add_hook 'prepare-commit-msg', File.join(File.dirname(__FILE__), 'prepare-commit-msg.sh')

  start_on_tracker story
end