Sha256: c373741e0f30f7849bbe7c92cf5d07dc05f1b42cad5e27ff37dc1fd253b96ff7

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

require 'pivotal-tracker'

module DeployAndDeliver
  class Project
    attr_reader :project

    def initialize(context)
      PivotalTracker::Client.use_ssl = context[:pivotal_tracker_ssl]
      PivotalTracker::Client.token = context[:pivotal_tracker_token]
      @project = PivotalTracker::Project.find(context[:pivotal_tracker_project_id])
    end

    def deliver_and_report
      stories.each{|story| story.update :current_state => 'delivered'}

      points = stories.map(&:estimate).compact.inject(:+)
      puts "* delivered #{stories.size} stories (#{points} points)"
      stories.each do |story|
        puts "  - #{story.story_type.capitalize}: #{story.name} (#{story.estimate} #{story.estimate == 1 ? "point" : "points"})"
      end
    end

    def stories
      @stories ||= project.stories.all(:current_state => 'finished')
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deploy_and_deliver-2.1.3 lib/deploy_and_deliver.rb