Class: PivotalIntegration::Command::Start
- Defined in:
- lib/pivotal-integration/command/start.rb
Overview
The class that encapsulates starting a Pivotal Tracker Story
Instance Method Summary collapse
-
#run(*arguments) ⇒ void
Starts a Pivotal Tracker story by doing the following steps: * Create a branch * Add default commit hook * Start the story on Pivotal Tracker.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PivotalIntegration::Command::Base
Instance Method Details
#run(*arguments) ⇒ 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
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/pivotal-integration/command/start.rb', line 34 def run(*arguments) filter = arguments.first use_current_branch = @options.fetch(:use_current, false) if filter == 'new' arguments.shift story = PivotalIntegration::Util::Story.new(@project, *PivotalIntegration::Command::New.collect_type_and_name(arguments)) else story = PivotalIntegration::Util::Story.select_story @project, filter end if story.estimate.nil? or story.estimate == -1 PivotalIntegration::Util::Story.estimate(story, PivotalIntegration::Command::Estimate.collect_estimation(@project)) end PivotalIntegration::Util::Story.pretty_print story development_branch_name = development_branch_name story PivotalIntegration::Util::Git.switch_branch 'master' unless use_current_branch PivotalIntegration::Util::Git.create_branch development_branch_name @configuration.story = story PivotalIntegration::Util::Git.add_hook 'prepare-commit-msg', File.join(File.dirname(__FILE__), 'prepare-commit-msg.sh') start_on_tracker story end |