Created
February 14, 2011 09:31
-
-
Save pauldruziak/825662 to your computer and use it in GitHub Desktop.
Generating the status update report for pivotaltracker.
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
| config.yml |
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
| token: your token for pivotaltracker |
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 'rubygems' | |
| require 'pivotal-tracker' | |
| require 'yaml' | |
| # patch for pivotal-tracker gem | |
| module PivotalTracker | |
| class Activity | |
| def self.encode_options(options) | |
| return nil if !options.is_a?(Hash) || options.empty? | |
| options_string = [] | |
| options_string << "limit=#{options.delete(:limit)}" if options[:limit] | |
| options_string << "newer_than_version=#{options.delete(:newer_than_version)}" if options[:newer_than_version] | |
| if options[:occurred_since] | |
| options_string << "occurred_since_date=#{options[:occurred_since].utc}" | |
| elsif options[:occurred_since_date] | |
| options_string << "occurred_since_date=#{options[:occurred_since_date]}" | |
| end | |
| return "?#{URI.escape(options_string.join('&'))}" | |
| end | |
| end | |
| end | |
| APP_CONFIG = YAML.load_file("config.yml") | |
| PivotalTracker::Client.token = APP_CONFIG['token'] | |
| activities = PivotalTracker::Activity.all(nil, :limit => 100, :occurred_since_date => Time.now.strftime("%Y/%m/%d 00:00:00 UTC")) | |
| states = activities.keep_if do |a| | |
| a.event_type == 'story_update' && !a.description.include?("edited") | |
| end.group_by do |a| | |
| a.stories[0].id | |
| end.group_by do |id, activities| | |
| activities.first.stories.first.current_state | |
| end | |
| {"accepted" => "Ready for production", "delivered" => "Deployed to staging", "finished" => "Done", "rejected" => [], "started" => "In progress"}.each do |state, title| | |
| if states.include?(state) | |
| puts title.upcase | |
| states[state].each do |id, activities| | |
| puts " " + activities.first.description.match(/\".+\"/)[0] | |
| activities.each do |activity| | |
| puts " " + activity.description.match(/^[\w ]+/)[0] + "(#{activity.occurred_at.strftime("%H:%M")})" | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment