Class: GitPivotalTrackerIntegration::Command::Newfeature

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

Overview

The class that encapsulates creating a Pivotal Tracker Feature Story

Instance Method Summary collapse

Methods inherited from Base

#check_version, #create_backlog_bug_story, #create_backlog_feature_story, #create_icebox_bug_story, #create_icebox_feature_story, #create_story, #estimated_seconds, #initialize, #logger_filename, #seconds_spent, #start_logging

Constructor Details

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

Instance Method Details

#run(args) ⇒ Object

Creates a Pivotal Tracker story by doing the following steps:

  • Takes arguments from command line

  • If arguments contains -i then it creates a feature story under icebox

  • If arguments contains -b then it creates a feature story under backlog

  • If arguments contains -tl then it creates a feature story at top of specified list

  • If arguments contains -bl then it creates a feature story at bottom of specified list

  • If arguments contains -p1 then it creates a feature story with estimate as 1 point.

  • If arguments contains -p2 then it creates a feature story with estimate as 2 points.

  • If arguments contains -p3 then it creates a feature story with estimate as 3 points.

  • If there are no arguments passed then it creates a feature story in icebox top of the list if you wish to create



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/git-pivotal-tracker-integration/command/newfeature.rb', line 32

def run(args)

  $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{Util::Git.branch_name}")
  story = nil
  if (!args.empty? && args.any?{|arg| arg.include?("-i")})
    story = self.create_icebox_feature_story(args)
  elsif (!args.empty? && args.any?{|arg| arg.include?("-b")})
    story = self.create_backlog_feature_story(args)
    	else
 puts "\n Syntax for creating new feature story in icebox top of the list:\n git newfeature -i -tl <feature-title> \n Syntax for creating new feature story in icebox bottom of the list: \n git newfeature -i -bl <feature-title>\n"
 puts "\n Syntax for creating new feature story in backlog top of the list:\n git newfeature -b -tl <feature-title> \n Syntax for creating new feature story in backlog bottom of the list: \n git newfeature -b -bl <feature-title>\n"
 user_response = nil
 while (user_response.nil? || user_response.empty?)
 user_response = ask("\nYou have missed some parameters to pass...If you are ok with creating new feature story in icebox then enter y otherwise enter n")
 end
 while !(["y","n"].include?(user_response.downcase))
 user_response = ask("\nInvalid entry...If you are ok with creating new feature story in icebox then enter y otherwise enter n")
 end
 if user_response.downcase == "y"
story = self.create_icebox_feature_story(args)
 else
 abort "\nCheck your new feature story creation syntax and then try again"
 end
  end
    	puts "A new feature story has been created successfully with ID:#{story.id}"
end