Created
March 12, 2012 16:39
-
-
Save jszmajda/2023226 to your computer and use it in GitHub Desktop.
Something to quickly create and deliver pivotal stories
This file contains hidden or 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 = '<redacted>' | |
| project = PivotalTracker::Project.find(project_id) # your project id | |
| project.create_stories( | |
| :requester => 'Josh Szmajda', | |
| :owner => 'Josh Szmajda', | |
| :stories => <<-EOT | |
| f1 Some awesome and quick feature [client] | |
| b2 An annoying bug! [fires] | |
| c3 Some really lengthy chore [gruntwork,client,frontend] | |
| EOT | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment