Class: PivotalIntegration::Command::Estimate

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

Overview

The class that encapsulates starting a Pivotal Tracker Story

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

desc, #initialize, #story

Constructor Details

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

Class Method Details

.collect_estimation(project) ⇒ Object



47
48
49
50
51
52
# File 'lib/pivotal-integration/command/estimate.rb', line 47

def self.collect_estimation(project)
  possible_scores = project.point_scale.split(',')
  score = -1
  score = ask("Choose an estimation for this story [#{possible_scores.join(', ')}, enter for none]: ") until possible_scores.include?(score) or score.blank?
  score.blank? ? -1 : score
end

Instance Method Details

#run(*arguments) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/pivotal-integration/command/estimate.rb', line 22

def run(*arguments)
  score = arguments.first

  unless score
    case story.estimate
    when -1
      puts "Story is currently unestimated."
    else
      puts "Story is currently estimated #{story.estimate}."
    end

    score = self.class.collect_estimation(@configuration.project)
  end

  case score
    when -1
      print 'Changing to unestimated... '
    else
      print "Changing estimation to #{score}... "
  end

  PivotalIntegration::Util::Story.estimate(story, score)
  puts 'OK'
end