Created
January 18, 2012 00:38
-
-
Save brianhempel/1630043 to your computer and use it in GitHub Desktop.
Quick script to get recent story names/urls for easy pasting into time tracking
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
# auto-install pivotal-tracker gem if not present | |
if Gem::Specification.find_all_by_name('pivotal-tracker').empty? | |
puts 'Installing pivotal-tracker gem...' | |
puts `gem install pivotal-tracker --no-ri --no-rdoc` | |
Gem.refresh | |
end | |
require 'pivotal-tracker' | |
# hack, he forgot this | |
PivotalTracker::Story.element(:updated_at, DateTime) | |
# find your token at the bottom of https://www.pivotaltracker.com/profile | |
PivotalTracker::Client.token = 'your_token_here' | |
PivotalTracker::Client.use_ssl = true | |
project_ids = [] # fill in project ids here | |
previous_days = (ARGV[0] || 7).to_i | |
start_date = Time.now - previous_days*(24*60*60) | |
projects = project_ids.map { |id| PivotalTracker::Project.find(id) } | |
projects.each do |project| | |
puts | |
puts "\033[1;30m#{project.name}\033[0m" | |
puts | |
project.stories.all(:modified_since => start_date.strftime("%m/%d/%Y")) \ | |
.sort_by { |story| story.updated_at } \ | |
.each { |story| puts "#{story.name} \033[0;34m#{story.url}\033[0m" } | |
end | |
puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment