Created
July 9, 2012 13:20
-
-
Save jszmajda/3076527 to your computer and use it in GitHub Desktop.
Utility script to create Pivotal Tracker stories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pivotal-tracker' | |
module PivotalTracker | |
class Project | |
def create_stories(options={}) | |
req = options[:requester] | |
own = options[:owner] | |
stories = options[:stories] | |
stories.split(/\n/).each do |story| | |
md = story.strip.match(/^([fcb])(\d) (.*?) \[(.*)\]$/) | |
story_type = case md[1] | |
when 'f' | |
'feature' | |
when 'c' | |
'chore' | |
when 'b' | |
'bug' | |
end | |
points = md[2].to_i | |
title = md[3] | |
tags = md[4] | |
self.stories.create( | |
:name => title, | |
:story_type => story_type, | |
:estimate => points, | |
:labels => tags, | |
:current_state => 'delivered', | |
:requested_by => req, | |
:owned_by => own | |
) | |
end | |
end | |
end | |
end | |
PivotalTracker::Client.token = '<YOUR TOKEN HERE>' | |
me = '<YOUR NAME AS IT IS IN PT>' | |
project = PivotalTracker::Project.find(70738) | |
project.create_stories( | |
:requester => me, | |
:owner => me, | |
:stories => <<-EOT | |
c4 Rebuild servers, etc post-storm [fires] | |
b1 Fix sales breakdown view [accounting] | |
f1 Tron: repair units paid and picked w/o order [tech] | |
c4 Research hadoop [data] | |
f4 Setup Karmasphere [data] | |
f4 Create test ETL system [data] | |
c2 Handle retail prices for bulk loads [operations] | |
EOT | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment