Created
May 26, 2011 17:24
-
-
Save scotttam/993560 to your computer and use it in GitHub Desktop.
Pull down the 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
begin | |
require 'pivotal_tracker' | |
rescue LoadError | |
puts "This script requires the pivotal-tracker gem: gem install pivotal-tracker" | |
exit(1) | |
end | |
CLIENT_TOKEN = 'GET YER OWN' | |
PROJECT_ID = 12345 | |
MILESTONE_LABELS = ['m1', 'm2', 'm3', 'm4'] | |
PivotalTracker::Client.token = CLIENT_TOKEN | |
project = PivotalTracker::Project.find(PROJECT_ID) | |
MILESTONE_LABELS.each do |current_label| | |
stories = project.stories.all(:label => current_label) | |
accepted_points = stories.inject(0) do |sum, story| | |
if story.current_state == 'accepted' | |
pts = story.estimate.to_i | |
else | |
pts = 0 | |
end | |
sum + pts | |
end | |
puts "" | |
puts "The #{current_label} milestone (Accepted: #{accepted_points})" | |
puts "------------------------------" | |
stories.sort { |x, y| x.current_state <=> y.current_state } | |
story_strings = stories.map do |story| | |
labels = story.labels.split(',').reject { |label| label.downcase == current_label } | |
sprintf("%-35s %-15s %-5s %-15s %s", labels.sort.join(', '), story.current_state, story.estimate, story.story_type, story.name) | |
end | |
story_strings.each { |ss| puts ss } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment