Deliver Tracker Stories from Capistrano

February 15, 2009 Pivotal Labs

The scene: Pivotal NYC

Jeff Dean walks up to Dan Podsedly, manager of Pivotal Tracker development.

Jeff: Hey Dan, you asked what features we wanted in Tracker. How about a way to automatically mark all my “Finished” stories as “Delivered”, all at once?

Dan: (with a sly smile) Well, we have an API call for it …

Thus was born my humble capistrano task which marks all your “Finished” stories as “Delivered”. Hook it into your demo deploy task and save yourself some time.

As an added bonus, if you have Paul Dix’s sax-machine gem installed (it’s a SAX object parser that uses nokogiri, which I co-wrote with Aaron Patterson), you’ll even get a brief summary report of the delivered stories in your cap output.

The code is below (you’ll need to generate a Tracker API key). Now go deliver some stories!

#  To use this task, simply set the following variables:
#    set :pivotal_tracker_project_id, PROJECT_ID
#    set :pivotal_tracker_token, TOKEN
#  Then, inside the task for your demo platform, add
#    task :demo do
#      ...
#      after :deploy, 'pivotal_tracker:deliver_stories'
#    end
namespace :pivotal_tracker do
  desc "deliver your project's 'finished' stories"
  task :deliver_stories do
    require 'rubygems'
    require 'activeresource'

    class Story < ActiveResource::Base = ""

    Story.headers['X-TrackerToken'] = pivotal_tracker_token
    puts "* delivering tracker stories ..."
    response = Story.put(:deliver_all_finished, :project_id => pivotal_tracker_project_id)

      require 'sax-machine'
      class Story
        include SAXMachine
        element :name
        element :story_type
        element :estimate
        element :description
      class Stories
        include SAXMachine
        elements :story, :as => :stories, :class => Story
      doc = Stories.parse(response.body)
      puts "* delivered #{doc.stories.length} stories"
      doc.stories.each do |story|
        puts "  - #{story.story_type}: #{} (#{story.estimate} points)"
    rescue LoadError => e
      puts "* stories delivered."

About the Author


Pivotal on webOS development in Palm Infocenter
Pivotal on webOS development in Palm Infocenter

Tim Carroll at Palm Infocenter recently spoke with Chris Sepulveda, our VP of Business Development, to ask ...

Split testing with Rails Part 2 – The Results Are In
Split testing with Rails Part 2 – The Results Are In

In my last article I ask you to visit Blabs and participate in a simple split test. A few hundred of you w...

SpringOne 2021

Register Now