add catchup
This commit is contained in:
parent
61ad631ba4
commit
73e0dca6d9
17
bin/tracker
17
bin/tracker
@ -7,6 +7,7 @@ require 'thor'
|
||||
require 'rainbow'
|
||||
require 'tempfile'
|
||||
require 'yaml'
|
||||
require 'chronic'
|
||||
|
||||
CACHE_TIME = 60
|
||||
GIT_PIVOTAL_PROJECT_ID_KEY = "pivotal.project-id"
|
||||
@ -69,6 +70,22 @@ class Tracker < Thor
|
||||
:score => '2255cc'
|
||||
}
|
||||
|
||||
desc "catchup", "Catch up on the latest changes to all your projects"
|
||||
method_options :limit => "30"
|
||||
def catchup(since = 'yesterday')
|
||||
PivotalTracker::Activity.all(nil, :limit => options[:limit].to_i, :occurred_since_date => Chronic.parse(since)).each do |activity|
|
||||
story = activity.description.dup
|
||||
story.gsub!(%r{^#{activity.author} }, '')
|
||||
story.gsub!(%r{"(.*)"}, '\1'.foreground(COLORS[:comment]))
|
||||
|
||||
time = activity.occurred_at.strftime('%Y-%m-%d %H:%M')
|
||||
|
||||
project = all_projects.find { |p| p.id == activity.project_id }
|
||||
|
||||
puts "[#{time.foreground(COLORS[:id])}] #{activity.author.foreground(COLORS[:label])} #{story} in #{project.name.foreground(COLORS[:project])} (#{activity.stories.first.id.to_s.foreground(COLORS[:id])})"
|
||||
end
|
||||
end
|
||||
|
||||
desc "feature NAME <score>", "Create a new feature in the current project"
|
||||
def feature(name, estimate = nil)
|
||||
params = { :name => name, :story_type => :feature, :current_state => :unstarted }
|
||||
|
@ -23,4 +23,5 @@ Gem::Specification.new do |s|
|
||||
s.add_runtime_dependency "pivotal-tracker", '~> 0.4.0'
|
||||
s.add_runtime_dependency "rainbow"
|
||||
s.add_runtime_dependency "thor"
|
||||
s.add_runtime_dependency "chronic"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user