class PivotalIntegration::Command::Estimate

The class that encapsulates starting a Pivotal Tracker Story

Public Class Methods

collect_estimation(project) click to toggle source
# 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

Public Instance Methods

run(*arguments) click to toggle source
# 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